method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f2d9bf17-bd0c-472d-8431-0db2315b562b | 9 | public void run()
{
NdefParser parser = new NdefParser(true);
Reader reader = new ACR122Reader(true);
byte[] result = null;
byte[] message = null;
while (!Thread.interrupted() && message == null) {
try {
if (reader.waitForDeviceReady(500)) {
Connection con = reader.getCon... |
4570275a-ae0f-4b5f-9550-c6f3d2880da4 | 9 | private DatabaseElement testButtonClick(ActionEvent evt, boolean showSuccessInfomationDialog) {
DriverInfo selectedItem = (DriverInfo) driverComboBox.getSelectedItem();
String name = textName.getText();
String url = textUrl.getText();
String username = textUsername.getText();
Str... |
16e3de50-1a21-4644-914a-d905d4a28e3c | 8 | public void instanceProduced(InstanceEvent e) {
Object source = e.getSource();
if (source instanceof InstanceProducer) {
try {
InstanceProducer a = (InstanceProducer) source;
switch (e.getID()) {
case InstanceEvent.FORMAT_AVAILABLE:
if (b_Debug) {
System.err.println(this.getClass().getNam... |
70faee9c-39c3-4718-a1ed-535d9f4c56ea | 8 | public HTTPRequest(Vector<String> headerData, String postData, String clientIP)
{
this.clientIP = clientIP;
Iterator<String> it = headerData.iterator();
String[] spaceSplit = it.next().split(" ");
type = spaceSplit[0];
path = spaceSplit[1];
while ( it.hasNext() )
{
String thisHeader[] = it.next().s... |
38cf5a3d-3014-4176-8153-2ff4880e66b6 | 8 | @Override
public void calculateFitness(List<Individual> population) throws Exception{
for(int i = 0; i < population.size(); i++){
try{
population.get(i).fitness();
}catch (Exception e){
int fitnessFactor = 0;
MaxOnePheno pheno = (MaxOne... |
703ae766-7b0e-4ff1-ad70-e238990b99fd | 5 | private void delete(int row) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.USER_MNG)) {
return;
}
User selectedRow = result == null ? null : result.get(row);
if (selectedRow != null) {
int result = JOptionPane.showConfirmDialo... |
844f1130-9669-4f69-9fba-cb2a9fdf2563 | 2 | private byte[] encrypt(EncryptableObject o, Key key) throws Exception{
String Algrithem;
if(key instanceof PublicKey){Algrithem = "RSA";}
else{Algrithem = "AES";}
ByteArrayInputStream i = new ByteArrayInputStream(o.toByteArray());
Cipher cipher = Cipher.getInstance(Algrithem);
cipher.init(Cipher.ENCRYPT_MOD... |
80cd0dcb-da13-4281-9a6a-13a744f201fc | 8 | public int createAssembly() throws IOException {
logger = Log.getLogger();
logger.debug("Packing ...");
removeOldAssemblies(targetLocation);
String loaderName = J2JSCompiler.compiler.getTargetPlatform().toLowerCase();
Writer writer;
if ("javascr... |
b6b70f30-223f-4271-ae5d-5314d166390e | 4 | public List<String> search(String number) {
Queue<String> tempQueue = new ArrayDeque<>();
List<String> words = new LinkedList<>();
tempQueue.add("");
for (int i = 0; i < number.length(); i++) {
String key = keyPad.get(number.charAt(i));
for (int qLength = tempQ... |
403c3c0f-c7fd-47fa-b799-c67b9e98c3a5 | 2 | public TokenManager(int cantidadDeTokensDeLookahead, FileReader archivo) throws FileNotFoundException, InvalidCantidadDeTokensDeLookaheadException {
//Aquí seteamos el archivo a ser leído
setScanner(new LexerJsonML(archivo));
//Contendra los tokens en un buffer
setBuffer... |
e3e7f5ed-a071-4189-b84e-ce1f0a2e0c63 | 6 | public ArrayList<Yhdistelma> yliviivattavat(){
Yhdistelma y = new Yhdistelma(kasi);
ArrayList<Yhdistelma> yhdistelmat = y.getYhdistelmat(); // Kaikki kädestä saatavat yhdistelmät
ArrayList<Yhdistelma> toReturn = new ArrayList<Yhdistelma>(); // Palautettavat yhdistelmät
for(int i=0; i<jatsiyhdistelmat.size(); i+... |
d17076e6-550d-4994-ae76-41627cbdcd46 | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
d3a9216b-14cd-49b7-9089-563b3146b56e | 5 | public int setup(String arg, ImagePlus imp) {
int i;
ImageStatistics stats;
stats=imp.getStatistics();
if (IJ.versionLessThan("1.31l")){
IJ.error("Needs ImageJ 1.31l or newer.");
return DONE;
}
if (stats.histogram[0]+stats.histogram[255]!=stats.pixelCount){
IJ.error("8-bit binary image (0 a... |
52451dc3-6dce-471c-a7bb-1868b6ac4dee | 8 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nCase = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
int times = Integer.parseInt(line.tr... |
c72cc6ca-ca5e-4a26-95b0-a32be1273647 | 2 | public void visitArrayRefExpr(final ArrayRefExpr expr) {
if (expr.array == from) {
expr.array = (Expr) to;
((Expr) to).setParent(expr);
} else if (expr.index == from) {
expr.index = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
dc8d2086-ede8-4047-a4f5-ff1ac269eded | 5 | private static void setUpHeightmap() {
try {
// Load the heightmap-image from its resource file
//TODO: ggf. heightmaps austauschen
// BufferedImage heightmapImage = ImageIO.read(new File("res/images/heightmap.bmp"));
BufferedImage heightmapImage = ImageIO.read... |
25039520-5253-45b9-b813-be7e6d3b97a9 | 7 | public static String dayOfWeekToText(int i) {
if (i == Calendar.SUNDAY)
return "Sunday";
else if (i == Calendar.MONDAY)
return "Monday";
else if (i == Calendar.TUESDAY)
return "Tuesday";
else if (i == Calendar.WEDNESDAY)
return "Wednesday";
else if (i == Calendar.THURSDAY)
return "Thursday";
... |
95b05ee9-d0a3-4bf3-b3f0-915d7e92bf89 | 7 | public String Actualizar() {
// some validations may be done here...
if (usuario.equals("")) {
mensaje = "";
mensaje2 = "Nombre obligatorio";
return "ActualizarUsuario?faces-redirect=true";
} else {
if (clave.equals("")) {
mensaje... |
aa34ba82-855d-4900-9042-4c10cdd09d18 | 1 | public BigDecimal getValue(int row, int clums, int sheetat) {
BigDecimal value = new BigDecimal(0);
String s = null;
try {
hSheet = hWorkbook.getSheetAt(sheetat);
hRow = hSheet.getRow(row - 1);
hCell = hRow.getCell(clums - 1);
hCell.setCellType(Cell.CELL_TYPE_STRING);
s = hCell.getStringCellValue()... |
826dcf4c-aaab-49ae-9238-aacbb8210928 | 4 | public static OreVein[] loadConf( List lst ){
OreVein[] ret = new OreVein[lst.size()];
for(int i=0;i<lst.size();i++){
MemoryConfiguration nd = new MemoryConfiguration();
nd.createSection( "sec", (Map<String,Object>) lst.get(i) );
ret[i] = new OreVein();
ret[i]... |
0ed93961-f157-4365-b405-a47357865bd5 | 8 | public boolean playerIsAllowed(String name) {
boolean bool = false;
if (portCommand.containsKey(name)) {
int cid = portCommand.get(name);
try {
Connection connection = service.getConnection();
Statement statement = connection.createStatement();
... |
643830dc-8281-45c4-826d-67146afac2c8 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
39ea2b5d-0f29-4795-9662-2d678a87cfb9 | 0 | public ThanatosPhantom(int room) {
super(new SoulStrike(), new Bash(), 90.0*room, 40.0*room, 0*room, 2.0*room, 80.0*room, 80.0*room, "Thanatos Phantom");
} // End DVC |
bc5afacf-8d5d-4da2-b9b1-07b723f31dda | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!(obj instanceof SevenSegmentDisplay)) return false;
SevenSegmentDisplay other = (SevenSegmentDisplay)obj;
return other.top == this.top
&& other.middle == this.middle
... |
57ba8381-d52d-4628-84eb-7995d344e48e | 0 | public void setVille(String ville) {
this.ville = ville;
} |
73a51bba-4e4c-4b49-83ca-1ba4628e6554 | 8 | public int adjacentLivesCount(int xIndex, int yIndex) {
int total = 0;
if(areInBounds(xIndex-1,yIndex-1)) total+=1;
if(areInBounds(xIndex-1,yIndex)) total+=1;
if(areInBounds(xIndex-1,yIndex+1)) total+=1;
if(areInBounds(xIndex,yIndex-1)) total+=1;
if(areInBounds(xIndex,yIndex+1)) total+=1;
if(areInBounds(x... |
84a6bf88-d2d6-4709-95ee-9b631c83eea6 | 9 | @Override
public void keyPressed(KeyEvent e) {
// Verifica si se oprime la tecla P para pausar o reanudar el juego
if (e.getKeyCode() == KeyEvent.VK_P) {
//Se cambia el estado de la variable pausa dependiendo de su
//valor actual y desaparece el letrero de desaparece
... |
691ef597-4266-4bba-8bd5-5ab281bac0d1 | 1 | public BigDecimal getValue1(int row, int clums, int sheetat) {
BigDecimal value = new BigDecimal(0);
String s = null;
try {
XSSFSheet xSheet = xWorkbook.getSheetAt(sheetat);
XSSFRow xRow = xSheet.getRow(row - 1);
XSSFCell xCell = xRow.getCell(clums - 1);
xCell.setCellType(Cell.CELL_TYPE_STRING);
s ... |
ecd435ec-d778-49bd-881a-9a175ff38651 | 6 | private Position getField(int xPos, int yPos) {
int rectSize = myBoard.getRectSize ();
int x, y;
if ( myBoard.getPerspective () == WHITE ) {
x = ( xPos / rectSize ) + 1;
y = ( yPos / rectSize ) + 1;
}
else {
x = AMOUNT_OF_CELLS - ( xPos / rectSize );
y = AMOUNT_OF_CELLS - ( y... |
b0ddba8f-b22f-4f08-a278-ff6c30a6f521 | 5 | public static final int getPresidence( char c){
switch( c ){
case '+':
return 0;
case '-':
return 1;
case '*':
return 2;
case '/':
return 3;
case '^':
return 4;
default:
return 100; //bad coding practice
}
} |
b6998454-da3a-4b91-b8ba-d8a7ac993376 | 9 | public void invokeMain(String sClass, String[] args) throws Throwable {
Class<?> clazz = loadClass(sClass);
logInfo(LogArea.CONFIG, "Launch: %s.main(); Loader: %s", sClass, clazz.getClassLoader());
Method method = clazz.getMethod("main", new Class<?>[] { String[].class });
boolean bVali... |
83a4ce75-23a7-4e34-9191-aebfaa8a73dd | 8 | private void addRangeData(Range r) {
Docuverse docuverse = r.refersTo();
Integer begin = (Integer) r.begins();
Integer end = (Integer) r.ends();
String xpath = null;
if (docuverse != null) {
docuverseMap.get(docuverse).add(r);
}
if (begin == null) {
begin = -1; /* To be indexed */
}
Set<Ra... |
93681d47-6b57-4d28-964a-7793cd303a52 | 8 | @SuppressWarnings("unchecked")
public static <T extends Number> ArrayList<ArrayList<T>> mulSparseMatrixWithArrayMatrix(SparseMatrix a, ArrayList<ArrayList<Double>> b,
Class<T> type) {
try {
ArrayList<ArrayList<T>> result = new ArrayList<ArrayList<T>>();
if (a == null || b == null) {
throw ne... |
3d4be8e6-3abd-47e6-9f26-2ebbc3b49613 | 2 | public List<Component> getAllProcessorsOfType(int processorType)
{
List<Component> outputData = new ArrayList<Component>();
try
{
// Query DB, gather results into output list
ResultSet res = DAO.getAllProcessorsOfType(processorType);
while (res.next()) {
Component newCmp = new Component();
newCm... |
f5c5d14f-d98c-4233-ab98-c219ae3d4d0f | 2 | @Override
public TestResult test(Object input, String... args) {
if( !InputType.isPrimitiveType(input) ){
throw new IllegalArgumentException("Parameter 'input' ONLY support primitive type.");
}
final String regex = args[0];
final String inputS = String.valueOf(input);
Pattern pattern = Pattern.compi... |
b32325f7-a5bd-423f-9ade-e77bbe1a391d | 2 | private static final byte[] encodeInteger(Integer integer)
{
int num_digits = 1;
int int_val = integer.intValue();
while((int_val /= 10) > 0)
++num_digits;
int_val = integer.intValue();
byte[] bencoded_integer = new byte[num_digits+2];
bencoded_integer[0] ... |
29682913-ae11-471e-afa5-8a45c8db5237 | 4 | public static void setSelectedX(int x) {
if (Main.selectedId != -1 && !Main.getSelected().locked) {
RSInterface rsi = Main.getInterface();
if (rsi != null) {
if (rsi.children != null) {
rsi.childX.set(getSelectedIndex(), x);
}
}
}
} |
bd5f6f28-0ff6-4195-86f5-f593e29df461 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof DiningCarriage))
return false;
DiningCarriage other = (DiningCarriage) obj;
if (tableCount != other.tableCount)
return false;
return true;
} |
834de88b-3e18-4be2-ac29-3f7ded16df34 | 8 | @Override
public boolean keyDown(int keycode) {
switch (keycode) {
case Keys.UP:
moving.add(Dir.North);
return true;
case Keys.DOWN:
moving.add(Dir.South);
return true;
case Keys.RIGHT:
moving.add(Dir.East);
return true;
case Keys.LEFT:
moving.add(Dir.West);
return true;
case Keys.Z... |
b8022e89-5a65-4053-abba-2873072f3346 | 1 | private boolean jj_3_79() {
if (jj_scan_token(YES)) return true;
return false;
} |
0a892ffa-7daf-4b82-9098-de6ee98a1107 | 0 | private void Initialize(int x, int y) {
// X and Y coordinate of track passed from game.java
this.x = x;
this.y = y;
} |
e7f5a18e-92d1-4f66-82eb-8235270d0623 | 2 | public static WeekOfMonthEnum fromValue(String v) {
for (WeekOfMonthEnum c: WeekOfMonthEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
61379d00-799f-4fee-94e6-7da404ef184a | 1 | @Override
public void actionPerformed(ActionEvent e) {
final JButton rafraichir = (JButton) e.getSource();
new Thread(new Runnable(){
public void run() {
try { Main.service.rafraichirListeLignes(); }
catch (IOException e) { e.printStackTrace(); }
}
}).start();
} |
ec98232a-128b-48b4-abdf-3e2d25d6238b | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
f541a9cc-5174-4254-9f3c-319f00373df1 | 9 | @Override
public boolean check() {
System.out.println(this.getClass().getSimpleName());
if (isLowerExists() == false) {
return false;
}
if (isLowerEqualsCurrent() == false) {
return false;
}
if (isUpperExists() == false) {
return fa... |
d10c4191-21f4-4d22-89c5-2294fd29b3e5 | 4 | public Model method540() {
Model models[] = new Model[5];
int j = 0;
for (int k = 0; k < 5; k++) {
if (anIntArray661[k] != -1) {
models[j++] = Model.getModel(anIntArray661[k]);
}
}
Model model = new Model(j, models);
for (int l = 0; l < 6; l++) {
if (anIntArray659[l] == 0) {
break;
}
... |
66af9605-5678-4fb7-b6e2-7a1365f0daf7 | 0 | public void setIpaddress(String ipaddress) {
this.ipaddress = ipaddress;
} |
93e69840-7131-4da8-9771-6e84719d8b89 | 3 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
String type = request.getParameter("type");
HttpRequest req = Enum.valueOf(HttpRequest.class, type.trim());
System.out.println("importantaffair " + re... |
a2f43e6b-28b0-40bf-a612-eae484470251 | 4 | public ClientCli(Config config, Shell shell)
{
this.config = config;
this.shell = shell;
try
{
socket = new Socket(config.getString("proxy.host"), config.getInt("proxy.tcp.port"));
directory = config.getString("download.dir");
input = socket.getInputStream();
objectInput = new ObjectInputStream(inp... |
6ad70e5a-ff7f-4f7b-8512-ef76b3c7cd17 | 0 | public AbstractPlay get(int number) {
return super.get(number);
} |
b9c6b6ca-0352-4ee9-9e57-7a775e916e3c | 3 | public Vector<String> getSessionId(){
Vector<String> resString = new Vector<String>();
CSVFileManager csvMgr = new CSVFileManager();
try {
SimpleMatchParser parser = new SimpleMatchParser(TokenType.parse(csvMgr
.readFile("res/SessionID.txt").getCSVObject()));
List<Token> result = parser.parse(answer... |
5365a077-3ab7-4847-9888-3e67afe05582 | 4 | @Override
public void mousePressed(MouseEvent e)
{
if (!e.isConsumed() && isEnabled() && isRubberbandTrigger(e)
&& !e.isPopupTrigger())
{
start(e.getPoint());
e.consume();
}
} |
2666e82c-d633-47f2-a74c-1b753ea6bf73 | 1 | public synchronized boolean remover(int i)
{
try
{
new AreaConhecimentoDAO().remover(list.get(i));
list = new AreaConhecimentoDAO().listar("");
preencherTabela();
}
catch (Exception e)
{
return false;
}
return true;
} |
915ed6a4-0658-4995-a13b-72d68dfdd0e5 | 7 | static Double M(Double[] prices, Integer[] volumes, Integer capacity) {
Double[] sol, mySol;
Double myFinalSol;
sol = new Double[prices.length];
mySol = new Double[prices.length];
if (capacity == 0) {
return 0.0;
}
for (int i = 0; i < prices.length... |
a1772901-8663-4813-984a-a2d38847eb16 | 8 | @Override
public double getFalsePositiveRate(String classValue)
throws IllegalArgumentException {
if( classValue == null)
throw new IllegalArgumentException("Error: null class value");
if( this.valueToIndex.get(classValue) == null)
throw new IllegalArgumentException("Error: state = " + classValue + " d... |
a9a49eee-5177-4ae1-85e9-659c5406cc28 | 4 | public void close() {
closed = true;
try {
if (inputStream != null)
inputStream.close();
if (outputStream != null)
outputStream.close();
if (socket != null)
socket.close();
} catch (IOException _ex) {
System.out.println("Error closing stream");
}
isWriter = false;
synchronized (this)... |
19d5691b-4405-4f80-9b7b-f2478a595f95 | 8 | public AutoCompletion(final JComboBox comboBox) {
this.comboBox = comboBox;
model = comboBox.getModel();
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!selecting) {
highlightCompletedText(0);
... |
f4b5ae30-4e42-4818-b5a3-9eecd943aef8 | 5 | public static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
boolean lastWasWhite = false;
boolean reachedNonWhite = false;
int len = string.length();
int c;
for (int i = 0; i < len; i+= Character.charCount(c)) {
c = strin... |
fae5eaa7-b6ea-4f5d-a7b9-03c6a59fad81 | 2 | public void flushBase64() throws java.io.IOException {
if (position > 0) {
if (encode) {
out.write(encode3to4(b4, buffer, position, options));
position = 0;
} // end if: encoding
else {
throw new java.io.IOException(
"Base64 input not properly padded.");
} // end else: decoding
... |
50bdae68-e01a-494f-a322-12f607ae8483 | 4 | public Table AddTable(Table table)
{
if (ColSize()!=table.ColSize()) return null;
// order sensitive
for (int i=0; i<AttributeNames.size(); i++)
{
if (!table.GetAttributeName(i).equalsIgnoreCase(AttributeNames.get(i))) return null;
}
for (int i=0; i<table.RowSize();i++)
{
Insert(table.GetRow(i))... |
d20854d4-21f4-46c1-bd8b-f3901eba201b | 6 | private String executeTask(String taskId) {
// Prepare a request object.
Request requestObject = new Request(tokenTS, taskId);
// Prepare a request message.
String request;
try {
// Attempt to serialize the request object into a string.
request = serializ... |
c76103d1-4cfa-4272-9ce3-dae1bcd889ef | 1 | protected void closeall(){
JInternalFrame [] x = desktop.getAllFrames();
for(int i=0 ; i<x.length ; i++){
x[i].setVisible(false);
}
} |
fa2f198e-0486-4905-ba0c-fe5fc2c330ab | 7 | public static BigIntStringChecksum fromString(String bics)
{
boolean returnIsNegative = false;
BigIntStringChecksum ret = null;
if (bics == null)
{
createThrow("Input cannot be null", bics);
}
if (startsWithPrefix(bics))
{
String nopref... |
fedeeee3-808f-4e7f-8c0c-6c0ef48fe741 | 3 | public static double binomialPDF(double p, int n, int k) {
if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero");
if (k > n) throw new IllegalArgumentException("\nk is greater than n");
return Math.floor(0.5D + Math.exp(Stat.logFactorial(n) - Stat.logFactorial(k... |
a2b9d64e-7ac6-4ae0-90bd-eb2d3160f10c | 4 | public static int[][] mixed(int length, int width) {
int[][] r = new int[length][width];
for (int i = 0; i < length / 2; i++) {
for (int j = 0; j < width; j++) {
r[i][j] = (i + j) % 2;
}
}
for (int i = length / 2; i < length; i++) {
for (int j = 0; j < width; j++) {
r[i][j] = j % 2;
}
}
... |
b6f51a14-8666-4b2a-830d-053b2c3fa092 | 1 | protected void saveToken(HttpServletRequest request) {
HttpSession session = request.getSession();
String token = generateToken(request);
if (token != null) {
session.setAttribute(ApplictionResources.getTransactionTokenKey(), token);
request.setAttribute(ApplictionResources.getTransactionTokenKe... |
f0220b14-e588-4b1b-8b38-0e96bf7fbe2f | 3 | public void checkCollision() throws Exception{
Rectangle rCharacter = new Rectangle(WIDTH/2-32+12, HEIGHT/2-32+24, 64-24, 64+6);
boolean check = true;
for (int i=0;i<stoneList.size();i++) {
Stone stone = (Stone) stoneList.get(i);
Rectangle rStone = stone.getNe... |
530a001e-9130-4e2f-9797-95d66a13ee25 | 0 | public void setCheatingAllowed(boolean _cheating) { this.cheatsAllowed = _cheating; } |
2512c612-b0eb-40a8-ae1a-cd36651d9682 | 6 | @Override
public boolean isForwarding() {
if (a == null || !a.isAlive())
return false;
if (b == null || !b.isAlive())
return false;
if (target == null || target.isClosed())
return false;
return isActive();
} |
bd2c22e5-1cd7-4d01-8873-d782136c5019 | 1 | public void stop() {
if (stopped()) {
return;
}
player = null;
outputLine.drain();
} |
19e53b82-6b59-4c41-9a43-860e9cd9ba39 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
01036662-3319-44d2-bf95-9cccab5ffc98 | 9 | public String consumeIdentifier() throws ParseException {
for (int i = 0; i < currentToken.length(); i++) {
final char c = currentToken.charAt(i);
if (('a' <= c && c <= 'z') ||
('A' <= c && c <= 'Z') ||
('0' <= c && c <= '9') ||
(c == '_') || (c == '.')) {
... |
cbd97f4b-c629-4ae2-aaab-3f41f628f4d2 | 2 | @Override
public void processNode(Node node) {
String namespace = node.getNamespaceURI();
Map<String, String> namespaces = new HashMap<String, String>();
namespaces.put("c", namespace);
logger.debug("Searching for environments.");
try {
NodeList environmentNodes = Utilities.selectNodes(node, "./c:environ... |
926ff9b0-4327-4633-bde6-066d61db1503 | 0 | public void setShape(Shape shape) {
this.shape = shape;
} |
4cee8eff-0b53-4276-8040-84256203667d | 9 | @Override
public void superSample(int[] input, int[] output)
{
int offs = this.offset;
final int h = this.height;
final int w = this.width;
final int st = this.stride;
final int[] buf1 = this.buffer1;
final int[] buf2 = this.buffer2;
final int count = this.dim * this.di... |
665ec74f-9a5b-4534-978c-72728e8bf1cd | 9 | private int read1(char[] cbuf, int off, int len) throws IOException
{
if( nextChar >= nChars )
{
/* If the requested length is at least as large as the buffer, and
if there is no mark/reset activity, and if line feeds are not
being skipped, do not bother to ... |
66d98000-e3ae-4a00-8778-0e6b5a984008 | 2 | public void open() {
Display display = Display.getDefault();
createContents();
shlCrisisList.open();
shlCrisisList.layout();
while (!shlCrisisList.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} |
a67c7739-5743-4492-bbc6-55264fd2e28e | 5 | public NeuronPair getNeuronPair(TYPE n1,TYPE n2){
NeuronPair np = null;
for(NeuronPair pair : pairs.keySet()){
if((pair.getN1()==n1 && pair.getN2()==n2) || (pair.getN1()==n2 && pair.getN2()==n1))
np = pair;
}
return np;
} |
051caf4d-2ca6-4f63-9b60-fda280ad4193 | 3 | public int sendfd ( FileDescriptor passFd ) throws IOException {
if ( this.streamClosed ) {
throw new AFUNIXSocketException("This OutputStream has already been closed.");
}
try {
int res = NativeUnixSocket.passFd(getFD(), passFd);
if (... |
a878debc-831f-409e-80bb-db2045cfc19b | 3 | public Date getDate() {
try {
Calendar c = Calendar.getInstance(timeZone);
if ((mode & DATE) != 0) {
String s = dateField.getText();
c.set(Calendar.YEAR, Integer.parseInt(s.substring(0, 4)));
c.set(Calendar.MONTH, Integer.parseInt(s.substring(5, 7))-1 +Calendar.JANUARY);
c.set(Calendar.DAY_OF_M... |
62f2f5c6-4e40-441e-9e87-2ea823336f43 | 8 | public Boolean checkForEqualityStudents(){
if (logger.isDebugEnabled()){
logger.debug("Called checking for equality");
}
if (elemGr != null) {
for (int i = 0; i < groups.size(); i++) {
if (elemGr.equals(groups.get(i).getFakulty()) || elemGr.equals(groups.g... |
96255ccd-71ef-49b2-8646-47e2f582b53a | 8 | public static int maximalRectangle(char[][] matrix) {
if (null == matrix || 0 == matrix.length) return 0;
for (int i = 1; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
if ('1' == matrix[i][j]) {
matrix[i][j] = (char) (matrix[i][j] + matrix[i - 1][j] - '0');
... |
22552308-abb3-4141-b997-952e2e944a3c | 1 | public void setPlayerRoles(){
// alternate who launches the ball
if((roundCount % 2) == 1){
p1.setRole(ATTACK);
p2.setRole(DEFEND);
}
else{
p1.setRole(DEFEND);
p2.setRole(ATTACK);
}
} |
9904f005-9b3d-4c8c-a169-f4d75c6cfb65 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Route route = (Route) o;
if (Double.compare(route.coeffDate, coeffDate) != 0) return false;
if (Double.compare(route.coeffSeats, coeffSeats) !=... |
be1822a9-abe5-463b-9379-bd76bba5d29b | 6 | public void restore(
Map<Class<? extends IUser>, List<Map<String, Object>>> usersAccountsDescription) {
if (usersAccountsDescription == null) {
}
if (usersAccountsDescription.isEmpty()) {
}
for (Class<? extends IUser> key : usersAccountsDescription.keySet()) {
for (Map<String, Object> currentAccoun... |
1f9406d3-d594-490c-bf48-2874de20b5e0 | 6 | protected double goldenSectionSearch(HashMap heldOutMap,double a,double b,double c,double tau,int typeCount){
assert(c>b&&b>a);
double d=0;
if(c-b>b-a){
d=b+resphi*(c-b);
}else{
d=b-resphi*(b-a);
}
if(Math.abs(c-a)<tau*(Math.abs(b)+Math.abs(d))){
return (c+a)/2.0;
}
double prob=getLogModelPr... |
676937c5-dc81-4961-aa74-62b844f92933 | 0 | public Hashtable <String, Integer> getGroupByName(String groupName){
return this.groups.get(groupName);
} |
8ae52f4f-c07e-42f7-8d89-6fa7b484411f | 8 | public PolicyProposalResult evaluateDeepSearch_innerMethod(
TransferredFile policyFileToTransfer,
TransferredFile dbSQLDumpFileToTransfer, Context initialContext,
long gid2, float maxRisk) {
logger.writeLog(Level.ALL,"Method evaluateDeepSearch_innerMethod, gid:"+gid+", thread number:"+Thread.currentThread()... |
dac1f3c0-3f7f-43bd-ac06-662393ccef7a | 3 | public boolean Jion(OptimusArray a1, OptimusArray a2, OptimusArray a3, OptimusShape start, OptimusShape off,OptimusCalculator c) throws WrongArgumentException
{
OptimusZone z1 = ci.openZone(a1.getZid());
DataChunk chunk = new DataChunk(z1.getSize().getShape(), z1.getPstep().getShape());
do{
int id = chunk.get... |
938f68de-49ac-47e1-a238-aea6a3123c2a | 1 | public int exprHashCode() {
int v = 17;
for (int i = 0; i < dimensions.length; i++) {
v ^= dimensions[i].hashCode();
}
return v;
} |
b13ca8c9-48aa-4649-804c-c5b3eef4cee6 | 4 | @EventHandler(priority = EventPriority.NORMAL)
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
if(block.getState() instanceof Sign)
{
Sign sign = (Sign) block.getState();
int line = CustomFunction.isURLSign(sign);
if(line == -1) return;
else
{
Player play... |
672ff8c9-eec7-45f2-bada-1ae86a3f9620 | 0 | @Before
public void setUp() {
} |
3cc306f5-0ce6-46ef-8a08-7651b4fa8b1c | 5 | public synchronized Users getUsers(String userKey) {
Users users = null;
if (userKey == null || userKey.isEmpty())
return users;
try {
String url = this.urlManager.getUsers(Constants.APP_KEY, userKey);
JSONObject jo = getJson(Methods.GET, url, null);
... |
ec9feb9b-68a3-43e9-bb34-f46a38bb7043 | 7 | @Override
public List<T> findByIdAndDeskripsi(String id, String des) throws HibernateException {
DetachedCriteria crit = DetachedCriteria.forClass(getDomainClass());
String id_table = "id";
String des_table = "deskripsi";
... |
481a803e-f02c-4399-a344-c726c8065762 | 0 | public Database() {
// TODO Auto-generated constructor stub
} |
e6d9e4a6-f393-4bb2-b013-88252e55ed6d | 8 | void passThroughAllBits() {
try {
Socket destinationHost = new Socket(host, port);
byte[] buf = new byte[1024];
boolean didNothing = true;
while(!this.sock.isClosed() && !destinationHost.isClosed()) {
didNothing = true;
if (sock.get... |
4565fb2f-edc5-4c2d-b147-4266a143192a | 2 | public Symbol insert(String name) throws RedeclarationError
{
// scan local list for a redeclaration of symbol with same name
//System.out.println("DEBUG: symTable for inner symTable" + symTable.toString());
for(Symbol s: this.symTable){
if(s.name().equals(name)){
throw new Redeclaration... |
6a77daab-8af8-4f72-aca7-488c2c876e37 | 6 | public void calculateScore() {
double basePoints = 750.0;
double multiplier = 1.0;
if(last_difficulty.equals("Easy")) {
multiplier = 1.0;
} else if(last_difficulty.equals("Medium")) {
multiplier = 1.5;
} else if(last_difficulty.equals("Hard")) {
multiplier = 2.0;
} else if(last_difficulty.equals("... |
ff389a30-6243-475b-bcef-c95d845c0898 | 5 | @Override
public RoleSchool addRoleSchool(String json, long id) {
RoleSchool role = null;
if (json.contains("Teacher")) {
role = trans.fromJson(json, Teacher.class);
}
if (json.contains("Student")) {
role = trans.fromJson(json, Student.class);
}
... |
2b0df3b6-3f50-4d9d-84c0-9aa0dcd98773 | 7 | private static int range(int low, int high, int nUpper){
int max = 0;
for(int i=low;i<high;i++){
StringBuilder sb = new StringBuilder();
Set<Character> digits = new HashSet<Character>();
for(int n=1;n<nUpper;n++){
int temp = i*n;
sb.append(temp);
for(char c : Integer.toString(temp).toCharArray(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.