method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
23d67355-7913-436e-9084-69fd9c51a1c9 | 6 | public Object[][] getRecords(String Query) {
Object data[][] = null;
int c = 0;
try {
try {
int rows = 0;
Statement st = con.createStatement();
Statement st1 = con.createStatement();
rs = st.executeQuery(Query);
... |
743e8467-f827-45c8-a00a-29c79ac264d0 | 6 | private void simplifyRationalNumber()
{
int lcd = Math.abs(getLargestCommonDivisor());
// simplify values and redistribute negative sign if needed
if (numerator == 0 && denominator != 0)
{
numerator = 0;
denominator = 1;
}
else if ((numerator / lcd) < 0 && (denominator / lcd) < 0 || (numerator / lcd... |
5ede6acf-dd60-409a-ba92-fb40bc5ca3eb | 4 | @Override
public void update(){
if(moving){
if(this.lastState!= 0){
sequenceIndex = 0;
}
this.lastState = 0;
setImageSequence(moving2);
long currentTime = System.currentTimeMillis();
if((currentTime - lastUpdatedTime) >= timeDelay){
if(sequenceIndex >= imageSequences.length-1){
sequenc... |
5509074a-8ec5-4278-8050-24449dd84e16 | 3 | @Override
public Object invoke(Context context,List<Object> arguments) {
if (arguments.size() == 2){
Object val = arguments.get(0);
Object pow = arguments.get(1);
if (val instanceof Number && pow instanceof Number){
return Math.pow(((Number)val).doubleValue(),((Number)pow).doubleValue());
}
}
... |
ae8f8f90-77c1-4997-94f5-bce6dd100589 | 1 | public static String getFileMainName(String path) {
path = getFileName(path);
if (path.lastIndexOf(".") > -1)
return path.substring(0, path.indexOf("."));
return path;
} |
3026f6df-d50d-4b13-8703-014ada64cd2b | 9 | @Override
protected void handleElement(Element configPartElement) {
//Read data
Color backgroundColor = parseColor(configPartElement.getAttribute("backgroundColor"));
HorizontalAlignment horizontalAlignment = parseHorizontalAlignment(configPartElement.getAttribute("horizontalAlignment"));
LayoutEngine layoutEn... |
c38abb2e-3ed2-47d0-9340-a0f313eab9ff | 4 | public ArrayList<ArrayList<Integer>> getCombine(int sta, int n, int k) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (k > 0) {
for (int i = sta; i <= n - k + 1; i++) {
ArrayList<ArrayList<Integer>> temp = getCombine(i + 1, n, k - 1);
... |
850952e8-a18d-4b9e-93cb-3086c9783521 | 9 | public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(new File("B-large-practice.in"));
PrintStream out = new PrintStream(new File("space.out"));
int testcases = scanner.nextInt();
// we multiply distances and speed with two so we don't have floats
... |
1119ee00-b7b9-4912-abdb-a2311117a28e | 3 | public static AbstractDataWrapper getWrapperInstance(WrapperType type, WrapperParams wrapperParams,
AuthFields authFields, GeoParams geoParams) {
AbstractDataWrapper wrapper = null;
switch (type) {
case TWITTER:
wrapper = new TwitterWrapper(wrapperParams, authFields, geoParams);
break;
case CSV:... |
13c59f7f-aad2-439f-bdf9-b74304cce15f | 5 | public boolean hasAtLeast(Bundle goal) {
for(ResourcePile requiredType:goal){
boolean enoughType = false;
for(ResourcePile whatIHave:contents){
if (whatIHave.type == requiredType.type){
if(whatIHave.amount < requiredType.amount) return false;
enoughType = true;
break;
}
}
if(!enough... |
6765e38a-f00e-4cd1-a931-92467ff87311 | 1 | public static int strbtoi(String binary)
{
final int ASCII_CUTOFF = 48;
final int BASE = 2;
int sum = 0;
for(int i = 0 ; i < binary.length() ; i++){
sum *= BASE;
sum += ((int) binary.charAt(i)) - ASCII_CUTOFF;//get the ascii value, then subtract the cutoff.
}
return sum;
} |
4f5f33fa-6143-4ec4-bf1a-3523e68688e4 | 7 | int countSkippedCells(int cellId) {
int segment = mesh.getSegmentNumber(cellId);
int row = mesh.getRow(cellId);
int offset = 0;
if (mesh.isOffsetRow(row)) {
offset = 1;
}
int n = mesh.getDistanceInCellsBetweenPoles() / 5;
if (row < 0) {
ret... |
4bd13fa4-6afb-4e2f-b5a7-84615408640b | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
75bd0b71-1a8d-4b05-b47e-ea54f99a0732 | 3 | public void checkVerticalCollision(Rectangle rtop, Rectangle rbot) {
if (rtop.intersects(r)) {
}
if (rbot.intersects(r) && type == 8) {
robot.setJumped(false);
robot.setJumpLimit(false);
robot.setSpeedY(0);
robot.setCenterY(tileY - 63);
}
} |
7f99db33-61db-4657-871a-e7719fa88b32 | 2 | private int getLightGrenadeCoverage() {
int nrSquaresLg = 0;
for (Element e : grid.getElementsOnGrid())
if (e instanceof LightGrenade) nrSquaresLg++;
return (nrSquaresLg * 100 / grid.gridSize());
} |
10a47630-5cee-4608-96a7-88a24bd5f19a | 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 Credentials)) {
return false;
}
Credentials other = (Credentials) object;
if ((this.username == null && other.u... |
8b0583de-4e3c-4753-bae6-0ab0cf404abd | 2 | public List<Host> commonPrefixIssues(String prefix) {
List<Host> list = new ArrayList<Host>();
PGridPath prefixPath = new PGridPath(prefix);
for (String path : unsolvedPaths_.keySet()) {
PGridPath otherPath = new PGridPath(path);
if (otherPath.hasPrefix(prefixPath)) {
... |
a43e3e81-c6f2-4d11-a25a-b1e67c78d5ef | 0 | public static void main(String[] args) {
int x = 0, y = 1, z = 2;
String s = "x, y, z ";
System.out.println(s + x + y + z);
System.out.println(x + " " + s); // Converts x to a String
s += "(summed) = "; // Concatenation operator
System.out.println(s + (x + y + z));
System.out.println("" + x); // Shorthand... |
d7cb69d2-884a-4715-9679-67308550e670 | 2 | public static void main(String[] args) {
Student std1 = new Student("Lopesman", 4, 5);
Student std2 = new Student("Kurotchkiman", 5, 5);
Student std3 = new Student("Ortisman", 0, 4);
Student std4 = new Student("Nikolajman", 4, 5);
Student std5 = new Student("Mishinman", 3, 0);
... |
cca2394c-e8c6-443c-a337-93c4a4b1d65e | 2 | @Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT");
while(rs.next())
{
// ObServicio.setId_Servicio(0);
// ... |
02216d85-fe37-4e76-805d-a62c243e1dc7 | 9 | public static int[] mergeSort(int[] array) {
if ((array.length==0)||(array.length==1)) return array;
else
{
int n= array.length/2;
int array1[] = new int[n];
int array2[] = new int[array.length-n];
for (int i=0;i<array.length;i++)
{
if (i<n)
{
array1[i]=array[i];
}
else
... |
5e1b251d-5258-4f96-ba3b-f3a6fba354d9 | 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... |
469cf7b2-69d7-4c8c-934f-b59887331690 | 3 | @POST()
@Path("add")
@Consumes("application/json")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player addPlayer(Player p)
{
UserTransaction utx = null;
p.setId(0);
try
{
System.out.... |
4b526fd4-a113-4f5d-975a-c34ea35a70c6 | 1 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (bodyBlock == oldBlock)
bodyBlock = newBlock;
else
return false;
return true;
} |
b4cd90d0-3634-4117-920e-a3a27dc4b650 | 3 | public Ins(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "cite":
cite = Cite.parse(this, v);
break;
case "datetime":
datetime = Datetime.parse(this, v);
br... |
62d54183-9cc5-4eab-9d59-35eab37dbd43 | 6 | private static JavaFunction createModel(final ShaderProgram shader) {
return new JavaFunction() {
@Override
public int call(LuaCallFrame lcf, int argCount) {
ArrayList<Face> faces = new ArrayList<Face>();
for (int i=0;i<argCount;i++) {
... |
9ced7567-6f1f-4bde-a9bb-65de4780ff95 | 3 | public void addNotify()
{
super.addNotify();
this.Added = true;
if (this.BufferImage == null) {
initializeBuffer();
}
for (int i = 0; i < this.ImageContainerChildren.size(); i++)
{
ImageContainer localImageContainer = (ImageContainer)this.ImageContainerChildren.elementAt(i);
... |
7a9eeefc-aae2-41aa-be7c-e545702f1763 | 6 | public String getXML()
{
StringBuffer xml = new StringBuffer();
xml.append( "<datavalidation" );
xml.append( " type=\"" + VALUE_TYPE[getValidationType()] + "\"" );
xml.append( " operator=\"" + CONDITIONS[getTypeOperator()] + "\"" );
xml.append( " allowBlank=\"" + ((isAllowBlank()) ? "1" : "0") + "\"" );
xm... |
8e202362-52cb-4c31-b1c8-94efdaad179a | 0 | public static String escapeXMLComment(String text) {
text = StringTools.replace(text, "-->", "-->");
return text;
} |
a181bbbe-f194-4355-b1a2-6348f6d0b6c0 | 3 | public double getPixel(int x, int y, int color) {
x = x - 1;
y = y - 1;
int rgb = img.getRGB(x, y);
Color col = new Color(rgb);
double c;
switch (color) {
case 0:
c = col.getRed();
break;
case 1:
c = col.getGreen();
break;
case 2:
c = col.getBlue();
break;
default:
c = 0;
}
... |
7a41570b-84c8-457a-b05c-da9398652e83 | 9 | public void actionPerformed(ActionEvent arg0) {
if (targetTabs.getSelectedIndex() == BLUDGEONING_TAB){
if (bAccuracy.getSelectedIndex() == ACCURACY_NULL){
Wound newWound = new Wound(damageModel.getBluntWound(
opponent.getSelectedIndex(), bludgeoningZone.getSelectedIndex(),
diceBag.rollD6(), dam... |
f3da3320-f342-4974-9d84-b21683f84a28 | 9 | @SuppressWarnings("rawtypes")
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D)g;
drawbackground(g);
drawScore(g);
if(GameCraft.direction == 3){
g2d.drawImage(ResourceLoader.ImageLoad("/playerback.png"), GameCraft.getX(), GameCraft.getY(), this);
}else if(GameCraft.directio... |
0063f872-a270-473f-bc16-bffdd847d0c7 | 3 | public static void main(String[] args) {
System.out.print("Введіть суму >> ");
Scanner in = new Scanner (System.in);
int sum = in.nextInt();
System.out.print("Введіть термін >> ");
int months = in.nextInt();
int percent = 0;
double all = 0;
System.out.println("*******************");
System.out.println... |
d166c702-82fb-4827-81ef-cea23b1c6db3 | 4 | public static MathElement[][] multiply(MathElement[][] m1,
MathElement[][] m2) {
if (m1[0].length == m2.length) {
MathElement[][] output = new MathElement[m1.length][m2[0].length];
for (int y = 0; y < m1.length; y++) {
for (int x = 0; x < m2[0].length; x++) {
output[y][x]=new MathVar(0);
for (... |
1b399dec-23ad-447a-976e-46accf8b5996 | 3 | private void dfs(Digraph<?> G, Object v) {
this.marked.put(v, true);
for (Object temp : G.getAdjacentVertices(v)) {
if (!marked.get(temp)) {
dfs(G, temp);
}
}
reversePost.push(v);
} |
41baabbf-9f7f-4ca5-8db0-85cbd46eae8b | 8 | public double fy_i() {
double d = 0.0;
if (hasCharge_i && hasCharge_j)
d += chargeChargeVsY_i();
if (hasDipole_i && hasDipole_j)
d += dipoleDipoleVsY_i();
if (hasCharge_i && hasDipole_j)
d += pjqiVsY_i();
if (hasDipole_i && hasCharge_j)
d += piqjVsY_i();
return d * rCD;
} |
275025d1-6948-404a-bc79-23dab09c4168 | 5 | public void listFileInDirectory() {
try {
File file = new File(DirectoryConfig.getInstance().getExtractDirectory());
if (file.exists() && file.isDirectory()) {
String[] filesNames = file.list();
for (int j = 0; j < filesNames.length; j++) {
... |
d3069d54-253d-49ff-884e-b6cb654e1e5d | 3 | public void checkCanCraft(Player player) {
for (int i = 0; i < costs.size(); i++) {
Item item = costs.get(i);
if (item instanceof ResourceItem) {
ResourceItem ri = (ResourceItem) item;
if (!player.inventory.hasResources(ri.resource, ri.count)) {
canCraft = false;
return;
}
}
}
canCr... |
3057f87f-e6a0-4926-a957-a417d2b745a9 | 4 | public int buscaMatricula(int matricula){
ResultSet rs;
String sql = "SELECT * FROM alunos";
String nomes="Matric | Nome | Endereco | Data Nasc.\n\n";
int resp=0;
try{
rs = meuState.executeQuery(sql);
while(rs.next()){
... |
b5e7c25a-53be-4acf-aee6-c958d9652f1b | 2 | @Override
public boolean isSetToDefaults() {
for (Command cmd : mMap.values()) {
if (!cmd.hasOriginalAccelerator()) {
return false;
}
}
return true;
} |
32a4ef7f-cd31-4ef8-b574-ac908b7389ba | 0 | public int specialAttack(){
return hero.specialAttack();
} |
6d9a13b7-7405-4595-9dc3-4b9edf274ad5 | 6 | public static KeyValueList loadConfigurationFile(String file) {
{ String temp000 = Stella.findFileInLoadPath(file, null);
file = ((temp000 != null) ? temp000 : file);
}
Stella.ensureFileExists(file, "load-configuration-file");
{ KeyValueList configuration = KeyValueList.newKeyValueList();
... |
03151259-f653-4e8e-a47b-61984bd75dd1 | 7 | public void keyPressed(int k){
if (savedGames.size() > 0){
if (k == KeyEvent.VK_UP){
Effect.MENU_MOVE.play();
currentChoice--;
if (currentChoice < 0) {currentChoice = savedGames.size() - 1;}
}
if (k == KeyEvent.VK_DOWN){
Effect.MENU_MOVE.play();
currentChoice++;
if (currentChoice > sa... |
f888d30e-738f-4abc-9569-2d20ca157724 | 6 | public void run() {
while (running) {
try {
sleep(10000);
if (LazyHomer.isSelectedSmithers()) LazyHomer.setLastSeen();
for(Iterator<MargeObserver> iter = observers.keySet().iterator(); iter.hasNext(); ) {
MargeObserver obs = (MargeObserver)iter.next();
String url = observers.get(obs);
o... |
d77608fd-b63e-4795-a4b3-136b681ce901 | 6 | public void test_01() {
String args[] = { "-classic", "-ud", "0", "-noOut", "testHg19Chr1", "./tests/missing_coding_tr_tag.vcf" };
// Run snpeff
SnpEff cmd = new SnpEff(args);
SnpEffCmdEff cmdEff = (SnpEffCmdEff) cmd.snpEffCmd();
List<VcfEntry> vcfEntries = cmdEff.run(true);
// Make sure transcript coding... |
3ea0e647-a7dc-411d-b8db-e79162b96769 | 8 | public double [] distributionForInstance(Instance instance) throws Exception {
if (m_Train.numInstances() == 0) {
throw new Exception("No training instances!");
}
if ((m_WindowSize > 0) && (m_Train.numInstances() > m_WindowSize)) {
m_kNNValid = false;
boolean deletedInstance=false;
... |
6a69c54a-3e08-4735-9758-11d9998adeed | 8 | private JsonBoolean jBoolean(boolean value) throws MalformedJsonException{
if(value){
if(next()=='r' && next()=='u' && next()=='e'){
next();
return new JsonBoolean(true);
}else{
throw jsonError("invalid value", true);
}
}else{
if(next()=='a' && next()=='l' && next()=='s' && next()==... |
b13bcbfd-9a84-4dea-88dd-608daf16fbf4 | 0 | public Card(char rank, char suit) {
myRank = rank;
mySuit = suit;
mySymbol = "" + rank + suit;
} |
fd05b4b6-3d1e-423f-8d6c-a4e0fbe7a168 | 1 | public NodeList getNodeList(String expression, Object context)
throws XPathExpressionException {
assert(expression != null);
if(context == null) {
assert(document != null);
context = document;
}
return (NodeList) xpath.evaluate(expression,
... |
89877179-1554-47ba-a68a-08e449cbfbcb | 6 | public static String[] findApprox(String[] sequences, Map<String, Integer> matrix, int gap,Extend extend) {
int bestValue=Integer.MAX_VALUE;
int bestSeq=0;
int value = 0;
for(int i = 0; i<sequences.length;i++){
value = 0;
for(int index=0; index<sequences.length;in... |
793290cc-85ff-4d86-bfd9-1879d8b268af | 0 | public Model() {
Analizer analize=new Analizer();
analize.start();
} |
ecba6b89-ec72-42b0-bfd8-d5f3dd76042e | 0 | public void setHora(int hora) {
this.hora = hora;
} |
1bd74b63-7c42-464e-a8f3-438d8362fa56 | 4 | private void parsePacket(byte[] data, InetAddress address, int port) {
String message = new String(data).trim();
PacketTypes type = Packet.lookupPacket(new String(message.substring(0,2)));
Packet packet = null;
switch(type){
default:
case INVALID:
break;
case LOGIN:
packet = new Packet00Login(data);... |
e7d442b6-ca12-449f-96aa-5e763e4f098d | 1 | public DrawPanel() {
setBackground(Color.WHITE);
lines = new MyLine[5];
ovals = new MyOval[5];
rectangles = new MyRectangle[5];
for (int count = 0; count < lines.length; count++) {
int x1 = rnd.nextInt(300);
int y1 = rnd.nextInt(300);
int x2 =... |
80f5dbf7-f3ec-4dbb-a56e-7eae9d56d256 | 4 | public static void main(String[] args){
if(args.length < 2){
System.out.println("Server or port no not specified.");
System.exit(1);
}
Socket socket = null;
DataOutputStream os = null;
DataInputStream is = null;
int portNo = Integer.valueOf(args[1]).intValue();
Scanner sc = new Scanner(System.in);
... |
c392cff4-8a41-4e9e-8dd5-609d58611b43 | 3 | public void setDict(Dictionary newDict)
{
if (newDict == null || (dict != null && newDict.getID().equals(dict.getID())))
return;
this.dict = newDict;
mainFrame.enableAddPhrase();
mainFrame.updateDictBtnText();
mainFrame.nextPhrase();
} |
cce18025-61cc-4f45-a354-a8225fed47c8 | 0 | public int getIntelligentX() {
return intelligentX;
} |
77199008-38c5-47dc-bdc1-61bd54b4407d | 3 | @Override
public void actionPerformed(JTable table)
{
String text = "<html><p>Are you sure you want to remove this media(s) from your library?</p>"
+ "<p><font size=-2>(The file(s) will not be removed from your drive)</font></p></html>";
int confirmation = JOptionPane.showConfirmDialog(nu... |
32f56c54-ac6d-4cf8-97bd-f714d8cd92bf | 1 | public final void unpauseLayer(GameLayer layer) {
if (!gameLayers.containsValue(layer)) {
logger.error(new NullPointerException(),
"Tried to unpause a game layer that isn't registered to the GameScreen :: ", this);
} else {
layer.unpause();
}
} |
252c6f1e-f35f-4e76-963a-cdd29972a7ff | 9 | public ConnectionSet disconnect(CellView[] cells) {
ConnectionSet cs = new ConnectionSet();
for (int i = 0; i < cells.length; i++) {
if (cells[i] instanceof EdgeView) {
EdgeView view = (EdgeView) cells[i];
CellView port = view.getSource();
if (GraphConstants.isDisconnectable(view.getAllAttributes()))... |
22cbd541-55f8-4048-8d68-0a546d5cc9b7 | 5 | public static void main(final String[] args) {
List<String> items = Utils.readFromFile("problem18.txt");
Collections.reverse(items);
//Utils.printList(items);
List<Integer[]> ints = convertToIntArray(items);
/*
* arr = list of each row of numbers
* 04 62 98 27 23 09 70 98 73 93 38 53 6... |
f8f3db78-6f4c-41d0-a649-cb28d885437b | 8 | public int trialDivide(BigInteger n) {
BigInteger m = n;
BigInteger p = TWO;
while (m.compareTo(BigInteger.ONE) != 0) {
if (m.isProbablePrime(10))
p = m;
if (limit != null && !limit.equals(BigInteger.ZERO) && p.compareTo(limit) > ... |
72d35ccf-23d9-43c2-9e83-4a538e53506b | 2 | @Override
public int registerUser(UserRequest request) {
int result = -1;
User unvalidatedUser = new User(request.getUsername(), request.getPassword());
if(users.indexOf(unvalidatedUser) == -1 && request.validatePreConditions()) {
users.add(unvalidatedUser);
result = users.indexOf(unvalidatedUser);
}
... |
9eee621a-1fff-44c9-9ee7-643f5da652e3 | 4 | public static Face opposite(Face face) {
switch(face) {
case NORTHERN:
return SOUTHERN;
case WESTERN:
return EASTERN;
case SOUTHERN:
return NORTHERN;
case EASTERN:
return WESTERN;
}
return null;
} |
bb03f5c3-2140-4745-939f-2c1c4c9cf227 | 9 | public void editar() {
habilitaBotoesCadastro();
habilitarCampos();
/*Na tela de rejeicção desabilita o campo tipo*/
if (conformidadeApontada != null) {
jComboBoxTipo.setEnabled(false);
}
jFCodDefeito.grabFocus();
jBEditar.setEnabled(false);... |
caec29ba-d6a5-40b1-9daf-4e42f100992f | 5 | public String buscarProspectoPorApellidoPaterno(String surname1){
//##########################CARGA_BASE DE DATOS#############
tablaDeProspectos();
//##########################INGRESO_VACIO###################
if(surname1.equals("")){
surname1 = "No busque na... |
11dc72cc-13b7-479a-a8ba-9e29bf12f7f7 | 3 | public final void setInjected(boolean injected) {
if (isInjected != injected) {
this.isInjected = injected;
if (isInjected()) {
onInject();
} else if (this instanceof Unloadable) {
((Unloadable) this).onUnload();
}
... |
cff17ed5-dc24-4edf-a37c-baaa7be03987 | 3 | public static Point randomOceanTile(int[][] sea)
{
ArrayList<Point> possibleTiles = new ArrayList<Point>();
//add the sea
for(int y = 0; y < sea[0].length; y++)
for(int x = 0; x < sea.length; x++)
possibleTiles.add(new Point(x, y));
//remove places that have already been shot
for(Point p : bombL... |
788e8e37-164b-450a-996b-276c7a82cbbd | 1 | public static Punto[] rungeKuttaOrden4(double x0, double xn, double h, double y0, Funcion fun) {
//Big decimal se utiliza para mayor precision a la hora de calcular el n
BigDecimal operacion = BigDecimal.valueOf((((xn-x0) / h) + 1));
int n = operacion.setScale(0, RoundingMode.HALF_UP).intValueEx... |
a5c8c8a3-265f-4cc0-b5c9-5a766a893782 | 6 | private static int parse(char[] chars, int offset, int len, int radix, boolean negative) throws NumberFormatException {
int max = Integer.MIN_VALUE / radix;
int result = 0;
for( int i = 0; i < len; i++ ) {
int digit = Character.digit(chars[i + offset], radix);
if( digit == -1 ) { throw new NumberFormatExcep... |
eeb732c4-95dc-4590-93ea-97d746569ac0 | 3 | @SuppressWarnings({ "rawtypes", "unchecked" })
private void rebuildModel() throws SQLException {
state("reload model");
firstLoad();
Vector columnNames = new Vector();
Vector data = new Vector();
int columns = rsltMetaData.getColumnCount();
for (int i = 1; i <= columns; i++) {
columnNames.addElement(rsl... |
821e754d-ad25-4059-ba59-16701083a057 | 8 | public void visitLdcInsn(final Object cst) {
if (mv != null) {
mv.visitLdcInsn(cst);
}
if (this.locals == null) {
labels = null;
return;
}
if (cst instanceof Integer) {
push(Opcodes.INTEGER);
} else if (cst instanceof Long) {
push(Opcodes.LONG);
push(Opcodes.TOP);
} else if (cst instance... |
35b85ffc-8887-46ca-85fb-effecf92b704 | 3 | public void populateMI_File(){
System.out.println("Inserting "+datasetSize+ " objects in the database. It might take a while...");
//Create and/or open the MI_File
MI_File mi_file=new MI_File(ref_objects_num, ki, ks, indexDirectory, referenceObjectsFile);
try{
//Let's begi... |
2dead574-4b78-4462-b5fd-974f8e00c4a4 | 5 | private boolean isEqualityTerm() {
return peekTypeMatches("NEQ") || peekTypeMatches("EQ")
|| peekTypeMatches("LESSER") || peekTypeMatches("GREATER")
|| peekTypeMatches("LESSEREQ") || peekTypeMatches("GREATEREQ");
} |
d8bff938-9a75-4db9-b364-e47fcd7e02a0 | 1 | public BallView(int x, int y) {
BufferedImage img = null;
try {
img = ImageIO.read(new File("src\\jark\\ball.png"));
this._elementSprite = new Sprite(img, x, y);
} catch (IOException e) {
e.printStackTrace();
}
} |
b439e155-4f11-4c59-8737-e206771ae65b | 3 | private void writeOP(SelectionKey key) {
SocketChannel socketChannel = (SocketChannel) key.channel();
ByteBuffer dummyResponse = null;
try {
dummyResponse = ByteBuffer.wrap("ok".getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
... |
088f53de-7bcb-472f-93c6-29f3348b5e5f | 8 | public boolean addTimingTask(int _round, _IALSynTask _task)
{
_lock();
try
{
if(null == _task)
return false;
//当本回合的时候,直接进行添加
if(_round == _m_iCurRound)
{
_m_lCurRoundTimingTaskList.add(_tas... |
785fcfc0-fd2c-4b9f-96b0-f88b419dd187 | 1 | public void finished() {
executor.shutdown();
try {
executor.awaitTermination(12, TimeUnit.HOURS);
} catch (InterruptedException exc) {
throw new RuntimeException(exc);
}
} |
e599d3a4-5ab5-4356-9708-c1ccbbdc343d | 1 | public boolean EliminarAplicacion(Aplicacion p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
bc1fffe3-7918-4465-ba7a-a8cf45115a92 | 1 | public boolean setCellFirstPlayer(int x, int y){
if (cellIsFree(x,y)){
setCell(x,y, FIRST_PLAYER_CELL_VALUE);
return true;
} else {
System.out.println("This cell is not empty");
return false;
}
} |
f1f1d766-d591-4f27-af9e-7ffab885f6fc | 5 | public void getSaves()
{
try
{
saveManifest = new File(this.getClass().getResource("/Orions_War/saves/spacegame manifest.txt").toURI());
}
catch (URISyntaxException e)
{
System.out.println("printing stack trace");
e.printStackTrace();
}
if(saveManifest == null) System.out.println("file null")... |
68ce22b4-dce7-4312-a187-67093a820a88 | 0 | public String toString()
{
return "Id: " + getId() + "\n"
+"Parent Id: " + getParentId() + "\n"
+"Number: " + getNumber() + "\n"
+"Type: " + getType() + "\n"
+"Question: " + getQuestion() + "\n"
+"Answer: " + getAnswer() + "\n"
+"Pass C... |
3bd04ade-4353-4839-905b-d74e0cdf1913 | 8 | static public double incompleteGammaComplement(double a, double x) throws ArithmeticException {
double ans, ax, c, yc, r, t, y, z;
double pk, pkm1, pkm2, qk, qkm1, qkm2;
if (x <= 0 || a <= 0) {
return 1.0;
}
if (x < 1.0 || x < a) {
return 1.0 - incomplet... |
738d78d2-f012-4d60-8f1e-341e0f35ebed | 8 | private GameState findSetToTrue(GameState state, Card card)
{
//Check the hand
for(Card c : state.getPlayer(card.getFaction()).getHand())
{
if(c.equals(card))
{
state.getPlayer(card.getFaction()).removeFromHand(c);
c.setTrue(state.getTime());
state.getPlayer(card.getFaction()).addToHand(c);
... |
35f364b0-4318-4edc-be86-4c3204e448ff | 5 | @Override
public void paint(Graphics g) {
double xscl = (double) getWidth() / array.length;
double yscl = (double) getHeight() / MAXVAR;
g.setColor(Color.BLACK);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.WHITE);
g.drawString(title, 0, 10);
... |
ff505920-bf99-49e2-a010-c4396bb9971b | 8 | public Scalar() {
super("Scalar");
saveChooser.addChoosableFileFilter(new FileFilter() {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
if (f.getName().endsWith(".jpg")) {
return ... |
3ecbfe15-6638-4abf-9ef8-3424ac0170f2 | 4 | public static String longToPlayerName(long l) {
if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) {
return null;
}
if (l % 37L == 0L) {
return null;
}
int i = 0;
char ac[] = new char[12];
while (l != 0L) {
long l1 = l;
l /= 37L;
ac[11 - i++] = VALID_CHARS[(int)(l1 - l * 37L)];
}
return new Strin... |
ba9ccae7-3dab-4060-bf99-5410b2efc3e5 | 2 | private int countItemsInInventory() {
Inventory inv = player.getInventory();
int items = 0;
for(int i = 0; i < inv.getItemCount(); i++) {
Item item = inv.getItem(i);
if(item != null) {
items++;
}
}
return items;
} |
de78016f-2464-42b8-886b-4139fa3b41ab | 4 | private Parse(Reader in, boolean anyKey) throws MalformedJsonException{
if (in==null) throw new NullPointerException("Input Reader mustn't be null!");
//init
INPUT = in;
ANYKEY = anyKey;
//read in first character.
next();
//try to parse
DATA = jValue();
//check - is this even need... |
21b5c90a-e23b-4d75-9249-0c77395bda7d | 5 | public static WirelessMonitor getInstance() {
if (OPERATING_SYSTEM.indexOf("win") >= 0) {
return new WindowsWirelessMonitor();
} else if (OPERATING_SYSTEM.indexOf("nix") >= 0 || OPERATING_SYSTEM.indexOf("nux") >= 0
|| OPERATING_SYSTEM.indexOf("aix") > 0) {
return new LinuxWirelessMonitor();
} else if (O... |
312548c6-c4ef-48e5-85e7-86f0de931ea4 | 2 | public void cargarProductos() {
try {
String sql = "SELECT * FROM productos";
Connection conn = Conexion.GetConnection();
PreparedStatement ps = conn.prepareStatement(sql);
pro = ps.executeQuery();
while (pro.next()) {
String[] row = ... |
78b8b82b-14f1-4db1-acd5-1f30b76bcc31 | 2 | private static String myDblToString(double value)
{
int approx = (int) value;
double remaining = value - approx;
if (remaining < 0.0001) return Integer.toString(approx);
if (remaining > 0.9999) return Integer.toString(approx + 1);
return Double.toString(value);
} |
e2fdc4e6-d397-48a3-8764-1d7a4cf6c754 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!cmd.getName().equalsIgnoreCase("backpack") || !cmd.getName().equalsIgnoreCase("bp"))
return true;
if (args.length == 0) {
if (sender instanceof Player) {
Player p = (Player) sender;
... |
bb21f822-0f66-4793-b238-ea69f0769f2c | 7 | public int method544(int arg0, float arg1) {
if (arg0 == 0) {
float f1 = anIntArray668[0] + (anIntArray668[1] - anIntArray668[0]) * arg1;
f1 *= 0.003051758F;
Class39.aFloat671 = (float) Math.pow(0.10000000000000001D, f1 / 20F);
Class39.anInt672 = (int) (Class39.aFloat671 * 65536F);
}
if (anIntArray665... |
6a2725aa-b61a-470a-bf5a-12d2c0f89cd9 | 1 | public void setBuilt() {
worker.setTask(null);
Task.Goto t = null;
if(worker.getClosestEntity(new EntityFilter(EntityFilter.INCOMPLETE)) == null) {
t = new Task.Goto(worker.getClosestEntity(new EntityFilter(EntityFilter.TREE)));
} else {
t = new Task.Goto(worker.getClosestEntity(new EntityFilter(Ent... |
b2791003-4e32-4e42-bd55-f2aaacac8f45 | 8 | public String notReplace(String str) {
String result = "";
for (int i = 0; i < str.length(); ) {
if ((i == 0 || !Character.isLetter(str.charAt(i-1))) && i+2 <= str.length() && (i+3 > str.length() || !Character.isLetter(str.charAt(i+2))) && str.charAt(i) == 'i' && str.charAt(i+1) == 's') {
... |
00764640-7f27-4e1b-8035-e8b80c601183 | 4 | public void close() {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (con != null) {
con.close();
}
}catch (Exception e) {
e.printStackTrace();
}
} |
55d968a6-8fb8-408c-9089-4b3177730c1a | 2 | public void createBanningSQLTables() throws SQLException {
sql.initialise();
if(!sql.doesTableExist("BungeeBans")){
System.out.println("Table 'BungeeBans' does not exist! Creating table...");
sql.standardQuery("CREATE TABLE BungeeBans (PlayerName VARCHAR(50) NOT NULL, TempBan BOOLEAN NOT NULL, TempBanEn... |
6bb30d80-1913-4192-8653-f526b1132861 | 6 | @Override
public boolean branch() {
if (!script.options.onlyHouseObelisk.get() // TODO: Move house obelisk here
&& script.options.banking.get()
&& script.options.useBOB.get()
//&& !ctx.bank.opened()
&& (ctx.summoning.timeLeft() <= 300 || !ctx.summoning.summoned())) {
if (nextPoints == -1) {
ne... |
746de74e-7c78-49dc-9038-74a36b765c37 | 4 | protected long getLastSampleTime( long startTime, long endTime, long resolution ) throws RrdException, IOException
{
if ( rrd == null )
openRrd();
long minSampleTime = Long.MAX_VALUE, sampleTime = 0;
for ( int i = 0; i < datasources.length; i++ )
{
if ( datasources[i].size() > 0 )
{
sampleTime =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.