method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0f70bebf-0aaf-4bb3-8e1e-58e96c8b2449 | 6 | public boolean isSubset(int[] a, int[] b) {
Arrays.sort(a);
Arrays.sort(b);
printArray(a);
printArray(b);
if (a.length > b.length) {
return false;
}
int i = 0, j = 0;
while (i < a.length && j < b.length) {
if (a[i] == b[j]) {
i++;
j++;
}else {
if (a[i] < b[j]) {
retu... |
5afa9b45-4c57-4953-ab04-a142a223f79f | 1 | public boolean isRead() {
/* if it is part of a += operator, this is a read. */
return parent != null && parent.getOperatorIndex() != ASSIGN_OP;
} |
4ac629ce-8256-4ac3-95f8-320014b7c2b4 | 4 | public void setListener(int i) {
if (i==0) {
panel.removeMouseListener(ch);
panel.removeMouseMotionListener(ch);
panel.removeMouseListener(ph);
panel.removeMouseMotionListener(ph);
panel.removeMouseListener(coh);
panel.removeMouseMotionListener(coh);
panel.addMouseListener(lh);
panel.addMo... |
4375acdd-7188-4883-9d53-fa686bbd0306 | 7 | @Override
public synchronized void open() throws IOException {
if (isOpen()) {
return;
}
CommPortIdentifier portIdentifier;
CommPort comPort;
Enumeration e = CommPortIdentifier.getPortIdentifiers();
while (e.hasMoreElements()) {
CommPortIdent... |
03ea3f1a-f19a-4f23-b0ca-8e0dc000e019 | 2 | public void actionPerformed(ActionEvent e) {
if (picFrame == null || !picFrame.isVisible()) {
picFrame = new JFrame("JMaps-Viewer");
picFrame.setLayout(new MigLayout("nogrid, flowy, ttb"));
picFrame.setSize(600, 600);
picFrame.setVisible(true);
picFram... |
b778b644-0480-4ef0-ab39-3eada5e77d36 | 2 | public static boolean hasAllAttributes(Element element, String[] labels) {
for (String label : labels)
if (!element.hasAttribute(label))
return false;
return true;
} |
c4207033-0380-4acd-9003-669350906609 | 7 | void cutSetup(CameraSubject subject, boolean isUser) {
if (mode == Mode.PLAN) return;
if (cutCount > 0 && mode == Mode.GAGGLE) {
//ignore this call if already doing a cut
return;
}
if (!isUser && mode != Mode.GAGGLE) {
//filter out all calls from sni... |
46cae6c4-f826-47aa-bfcd-27f4127080fb | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.T... |
6b7498e7-487d-4e4e-a217-0a0584cbdcd4 | 1 | public static InputStream createInputStream(final File file) throws FileNotFoundException {
if (file == null) {
throw new IllegalArgumentException("null not allowed");
}
return new FileInputStream(file);
} |
181f8532-035c-48a4-93d3-628beff9fc20 | 2 | public double[] standardizedPersonTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedPersonTotals;
} |
635b5124-32fe-498c-a42c-e9a5baa5591f | 3 | public void checkDeclaration(Set declareSet) {
if (initInstr instanceof StoreInstruction
&& (((StoreInstruction) initInstr).getLValue() instanceof LocalStoreOperator)) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo()... |
dcd18dc4-ae54-474c-b754-d6c6f2b24ab6 | 4 | protected void doFunction(float[] inputs, int inputOffset,
float[] outputs, int outputOffset) {
// calculate the encoded values for each input
float input = inputs[inputOffset];
int subdomain = 0;
while (subdomain < bounds.length && input >= bounds[subdomain]) {
... |
b72a6815-8cb3-4b04-9406-51d6db9672d0 | 7 | public void readData(){
//empty lists for packets and nodes
packets = new ArrayList<MACPacket>();
nodes = new ArrayList<Node>();
DecoderView view = new DecoderView();
//checks for the use of standardized protocols
boolean protocols = view.askForProtocols();
//get address out of dialog
FileDialog fd... |
9407819b-22c7-4625-baf1-b4c475f493fd | 0 | public void setEventBeanList(ArrayList<EventsBean> eventBeanList) {
this.eventBeanList = eventBeanList;
} |
b06aeb00-5fd2-4659-90fb-5b17895e403e | 2 | public LinkedList<Stock> getExpensiveStocks(int quantity){
LinkedList<Stock> sorted = qs.qsort(stocks, 1); // sort by price
LinkedList<Stock> ret = new LinkedList<Stock>();
if (quantity > sorted.size())
quantity = sorted.size();
for (int i = sorted.size() - 1; i >= sorted.size() - quantity; i--)
ret.add... |
99e9b70b-e139-4f09-bd7c-3b8a5a956b3b | 3 | public void addCharacterIcon(){
ImageCreator charIcon = null;
try {
if (player.getType().equalsIgnoreCase("Warrior")){
charIcon = new ImageCreator("WarriorIcon.jpg");
}
else if (player.getType().equalsIgnoreCase("Marksman")){
charIcon =... |
7281226a-9b04-4bc6-8871-65970f6d6738 | 6 | public static boolean delRow(String id) throws SQLException, IOException {
boolean isDel = false;
PreparedStatement prStDelRow = null;
String query = "DELETE FROM `mobilephone` WHERE id=?";
Connection conn = DBConnection.getConnection();
try {
conn.setAutoCommit(false);
prStDelRow = conn.prepareStateme... |
b1cf6e69-3445-49d6-8128-2c66c73bd6b9 | 4 | public void updateBoxes()
{
int num = currentMonth.getFirstDay();
if (num ==0)
num=7;
for (int i = 1;i<=currentMonth.getDaysInMonth();i++)
{
Box tempBox = boxes.get(i+num-1);
Day currentDay = currentMonth.getDays().get(i-1);
tempBox.setDayStored(currentDay);
tempBox.setMonthStored(c... |
b7ed1fca-def0-4c64-9d9a-da1a6e9ab671 | 1 | public void writeRevTable() {
TranslationTable revtable = new TranslationTable();
basePackage.writeTable(revtable, true);
try {
OutputStream out = new FileOutputStream(outRevTableFile);
revtable.store(out);
out.close();
} catch (java.io.IOException ex) {
GlobalOptions.err.println("Can't write rename... |
e95718b2-0de2-4215-a7cb-7e1ab95fffc4 | 3 | public AbstractQualifiedMetadata(final Class<?> clz) {
if (clz == null) throw new IllegalArgumentException("Unspecified class");
this.clz = clz;
this.qualifiedName = clz.getCanonicalName();
this.packageName = clz.getPackage() == null ? null : clz.getPackage().getName() ;
this.name = clz.getSimpleName();
} |
0fbea759-11e8-468f-9d3b-72ce3136ef48 | 3 | public static void save(String fileName) throws FileNotFoundException {
// prepare to write to file
FileOutputStream fout = new FileOutputStream("plugins/" + Main.pluginName + "/" + fileName);
ObjectOutputStream oos;
try {
// attempt to write to file
oos = new ObjectOutputStream(fout);
try {
/... |
af8eae6c-69a4-4bc6-9dc1-2ec09fb2a1aa | 6 | public void promoteNameToValue() throws IOException {
expect(JsonToken.NAME);
Iterator<?> i = (Iterator<?>) peekStack();
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
stack.add(entry.getValue());
stack.add(new JsonPrimitive((String)entry.getKey()));
} |
2439a5cd-882f-44c0-ab38-5aded72a7362 | 7 | public void readCSVFileFromDisk(String fullFileNameAndPath, int maxLines){
BufferedReader bufferReader = null;
String line;
String seperator = ",";
int countLines;
try{
bufferReader = new BufferedReader(new FileReader(fullFileNameAndPath));
... |
4ef174ef-50e1-4223-bac4-1ed7e52183fa | 3 | public static int getMaxEnchants(WeaponType type) {
switch (type) {
case mel_sword:
return 1;
case mel_hammer:
return 2;
case rng_bow:
return 1;
}
return 1;
} |
b4154a88-3371-49d2-bbcb-c86939f5fc50 | 1 | public int compareTo(VersionString arg0) {
if(arg0==null)
throw new NullPointerException("cannot compare VersionString to null");
return compareVersions(version,arg0.toString());
} |
92f4a804-68d5-4882-9c63-2705f604e15a | 3 | private void addShipIntoGrid(Ship s) {
boolean horizon = Character.toUpperCase(s.shipOrientation) == 'H';
if(horizon) {
for(int i =s.shipPosition_x; i <s.shipPosition_x+s.shipSize;i++) {
this.board[s.shipPosition_y][i] = s.character;
}
}
else {
for(int i =s.shipPosition_y; i <s.shipPosition_y+s.s... |
bca2d820-a213-4549-8250-5995f53e8e23 | 1 | @Override
public void dispose() {
if( !disposed ) {
disposed = true;
disposeDependentItems();
getGraph().removeItem( this );
}
} |
36ce8b65-aa10-4b0d-9c21-1c7564000fa8 | 2 | private void drawTextInBackground(Graphics2D g) {
Font original = g.getFont();
g.setColor(TEXT_COLOR);
g.setFont(BIG_FONT);
String date = showDate.format(new Date((long) day * 24 * 3600 * 1000));
if (x > 0.8 * W) {
g.drawString(date, x - 200, y - 15);
} else {
g.drawString(date, x, y - 15);
}
int ... |
2b9c1a20-c7fd-4ebc-a8f0-f5fef532dcb8 | 2 | private void blitNumber(int number, int x, int y) {
if (numbers!=null) {
String sNum=Integer.toString(number);
for (int i=0; i<sNum.length(); i++) {
char cNum=sNum.charAt(i);
int iNum=cNum-48;
buffer.blit(numbers, iNum*5, 0, x, y, 5, 9, FrameBuffer.TRANSPARENT... |
d862a185-0c51-4623-bd0e-61fdc0dddcf1 | 2 | public List<ValidateException> validateDay(int dayOfBirth) {
List<ValidateException> validateExceptionList = new LinkedList<>();
if ((dayOfBirth < 1) || (dayOfBirth > 31)) {
String exMsg = "entered wrong day of birth";
validateExceptionList.add(new ValidateException(String.forma... |
a4f1d506-6e8f-49d4-91ac-5ec6bdd5b8ec | 0 | public void setUsername(String username) {
this.username = username;
} |
15833a18-ce15-46cd-89fc-85035c2fedb7 | 8 | public void update(Pattern p)
{
patternString.getDocument().removeDocumentListener(patternStringListener);
name.getDocument().removeDocumentListener(nameListener);
author.getDocument().removeDocumentListener(authorListener);
width.removeChangeListener(widthListener);
height.removeChangeListener(he... |
9eb36d8e-7d28-4146-bf5b-ea314f58c30c | 2 | public void setLength(int length) throws IllegalStateException, IllegalArgumentException {
if (data == null) {
throw new IllegalStateException("Internal buffer not initialized");
}
if (length > data.length) {
throw new IllegalArgumentException("Internal buffer length (" + data.length + ") is less than lengt... |
b1c168fb-32d8-4fbc-be85-95d529f89113 | 6 | public static int minDepth(TreeNode root) {
if(root == null){
return 0;
}
int leftMin = minDepth(root.left)+1;
int rightMin = minDepth(root.right)+1;
if(root.left == null && root.right != null){
return rightMin;
}else if(root.right == null && root.left != null){
... |
2120a6e8-6f63-48d5-a06a-aa9046c8cf69 | 2 | protected static String removeNewLineSignFromStart(String text) {
if (text.length() == 0) {
return text;
}
if (text.charAt(0) == '\n') {
return text.substring(1, text.length());
} else {
return text;
}
} |
9993ba07-2fc3-46f9-9ed7-1fa664b50a03 | 4 | public List<Kli> addKlis(int index, List<Kli> klis){
Kli parent = klis.get(index);
for(Kli temp : klis) {
if (temp.getParentTermCode()==parent.getTermcode()&&klis.contains(temp)){
klis = this.addKlis(klis.indexOf(temp), klis);
if(!parent.getChildren().contains(temp)){
parent.getChildren().add(te... |
63e3618b-0580-4169-b850-71c9dd82545f | 9 | private void nuevesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nuevesMouseClicked
// TODO add your handling code here:
try {
if (conexion == true && enviando == 0) {
enviando = 1;
int opciones;
if (esinicio != 0 && 9 <= esi... |
39d16fc9-bb63-4bdd-a7a8-82870520dbfb | 7 | public static void showOutput(int pair1, int pair2, char[] gameArray, boolean[] flipped) {
int space, d, l = 1;
//method called while the game is still in process
for (d = 0; d < gameArray.length; d++) {
if (d == (pair1 - 1) || d == (pair2 - 1) || flipped[d]) {
//show the face value of the ... |
dbecba75-fbdb-4536-a7f4-ea52dc601676 | 3 | public void testApp(){
System.out.println("Starting menuXML test\n");
IMenuFactory factoria = new XMLMenuFactory();
try {
String path = null;
String nombre = "menu1";
String fileName = nombre + "_menu.xml";
String full_classPath = System.getProperty("java.class.path");
... |
7088a7d7-b2d9-4798-9e54-842c12e3a8d9 | 3 | public static void create1kgFile() throws IOException {
String vcfFile = Gpr.HOME + "/snpEff/1kg.indels.vcf";
String vcfOutFile = Gpr.HOME + "/workspace/SnpEff/tests/1kg.indels.vcf";
StringBuilder outvcf = new StringBuilder();
VcfFileIterator vcf = new VcfFileIterator(vcfFile);
for (VcfEntry ve : vcf) {
... |
cd747021-a8fa-4f43-90ea-aa9865f0eb26 | 9 | public static void copyDirectory(File sourceDirectory, File targetDirectory, String locale) throws Exception
{
if(!targetDirectory.exists())
{
targetDirectory.mkdirs();
}
File[] sourceFiles = sourceDirectory.listFiles();
for(File sourceFile : sourceFiles)
{
File targetFile = new File(targetDirectory.... |
ed8b52c7-8d27-4e48-92ff-51f8720667af | 0 | public Node getOldNode() {
return oldNode;
} |
79a1f28b-4913-44f3-94c8-d69f44cb8905 | 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... |
5ca4d64f-6c05-4b7a-af01-a17db3271095 | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} ... |
4323884f-52e9-4b55-9ee6-83348981c48c | 1 | public void beginMinimizedAutomaton(FiniteStateAutomaton dfa,
DefaultTreeModel tree) {
// Create the new view.
remove(controlPanel);
FiniteStateAutomaton newAutomaton = new FiniteStateAutomaton();
minimizer.createStatesForMinimumDfa(dfa, newAutomaton, tree);
SelectionDrawer drawer = new SelectionDrawer(new... |
04f64012-9366-4d1a-ae97-af945c5b19b1 | 5 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button1) {
int[] ints = table1.getSelectedRows();
for (int rowNum : ints) {
if (fatherPanelState == 0) {
((SectionPanel) fatherPanel).addQ(new QuestionPanel((i... |
5f4034b5-07a2-44d4-9ed8-15015c20715d | 7 | public void run(){
try {
while (true) {
if ((fserver = in.readLine()) != null) {
if (fserver.equals("Server message: too many users")) {
System.exit(0);
break;
}
if (!validate ... |
10b0134b-1911-4780-a97a-fd6736febfdd | 1 | public AbstractGraph<BCNode,BCEdge> createGraph() {
ArrayList<String[]> rawData = importData(_filename);
BCNode[] dataset = inputToBCNodes(rawData);
dataset = normalizeData(dataset);
//create graph
AbstractGraph<BCNode, BCEdge> graph = new UndirectedSparseGraph<BCNode, BCEdge>();
for(BCNode curre... |
e3c76f73-209b-42e7-98bc-1417c359de6b | 4 | @Override
protected void mutate(Individual indiv) {
Expression ex = ((Expression) indiv);
if (ex.isLeaf())
((Leaf) ex).rebuild();
else{
Operator op = (Operator) ex;
if (ex instanceof If){
Expression aux = op.expressions[1];
op.expressions[1]=op.expressions[2];
op.expressions[2]=aux;
} els... |
e7f6b7eb-c6d1-4a0b-b90d-85f0310a7907 | 4 | @Override
public void Parse(Session Session, EventRequest Request)
{
if (!Session.GrabActor().InRoom())
{
return;
}
String Str;
if (Session.GrabActor().OverrideSpeech != null)
{
Str = Session.GrabActor().OverrideSpeech;
}
else
{
Str = Request.PopFixedString();
}
Session.GrabAct... |
ef0cb35f-8dac-465d-bb35-8ab2fd549013 | 6 | private void algo(String root) {
Vertex rootVertex = graph.getVertex(root);
Set<Vertex> vertices = graph.getVertices();
if(rootVertex != null) {
for(Vertex v : vertices) {
v.setKey(INFINITY);
v.setParent(null);
}
rootVertex.setKey(0);
}
minWeightVertices.addAll(ve... |
628c476f-a525-4f5c-9103-6013f07bd076 | 8 | public static Mesh loadMesh(String fileName)
{
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
if(!ext.equals("obj"))
{
System.err.println("Error: File format not supported for mesh data: " + ext);
new Exception().printStackTrace();
System.exit(1);
}
... |
34f1d7cc-11c2-4dec-b0f0-5027c420a6eb | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TeamSales other = (TeamSales) obj;
if (!Objects.equals(this.teamId, other.teamId)) {
return f... |
b1783968-a9c3-4711-bc29-69fe9a022858 | 6 | @Override
public void remove() {
if (!fjernOK) {
throw new IllegalStateException("Ulovlig tilstand!");
}
fjernOK = false;
if (antall==1) {
hode = hale=null;
antall--;
cursor--;
antallEndringer++;
forven... |
2145a49f-2120-4574-8576-60008f4c2088 | 2 | public HUDArea getHUDAreaByType(String name) {
HUDArea hudArea;
for (int i = 0; i < hudAreas.size(); i++) {
hudArea = hudAreas.get(i);
if (hudArea.getType().equals(name)) {
return hudArea;
}
}
return null;
} |
7e24aebd-eb5b-405a-8294-7b4ad07e5ab6 | 0 | String getState() {
return String.valueOf(state);
} |
1bc9b7ae-3f3f-4fea-bc7e-d5b9db0f3bd9 | 2 | private void outputDialog(JTextPane pane){
Scanner fileScanner;
System.out.println("Default Output Rule File Path: " + outputRuleFilePath);
try {
//System.out.println("Printing rules");
fileScanner = new Scanner(new FileInputStream(outputRuleFilePath));
writeOutput(pane, "\nOutput Rule File : " + ou... |
69fa9d2f-4859-4a18-994b-4045513ffff7 | 6 | public ResultSet preencherTabelaEncarregadOTodosdepartamento() throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL... |
b5997204-6bdb-491c-8148-cb5114b6eb2c | 3 | protected void processUserBlocks(List<List<String>> userBlocks) {
if(generateStatistics) {
for(List<String> blockList : userBlocks) {
for(String block : blockList) {
statistics.setPreservedSize(statistics.getPreservedSize() + block.length());
}
}
}
} |
2932115b-272e-4d1e-a420-12dcddbb0081 | 6 | @Override
public void run() {
while(alive){
try {
Thread.sleep(field.rnd.nextInt(300));
switch(field.rnd.nextInt(3)){
case 0:
field.moveItem(this, myPosition, new Position(myPosition.getX(), myPosition.getY()-1));
... |
032266f5-26fe-4023-ad73-9d8372809d8b | 4 | public static ScriptInfo[] getScriptDefinitions() {
try {
final List<ScriptInfo> definitions = new ArrayList<ScriptInfo>();
final List<String[]> jars = getData();
final List<byte[]> scriptList = getScriptByteList();
if (jars != null) {
for (int i =... |
9f7bd8ed-6f61-4052-bfe0-3e338e2dcb3e | 3 | public void render(){
BufferStrategy bs = getBufferStrategy();
if (bs == null){
createBufferStrategy(3);
requestFocus();
return;
}
level.renderBackground(xScroll, yScroll, screen);
for(int y = 0; y < screen.h; y++){
for(int x = 0; x < screen.w; x++){
pixels[x+(y*WIDTH)] = screen.pixels[x... |
3f3f518f-7749-4eb4-aa2f-1df6841b6296 | 0 | @Override
public void run() {
model.update();
} |
a37e4872-75d0-48a3-a7e0-0fb17e399beb | 7 | private boolean processArguments(final String[] args)
throws CommandException
{
log.debug("processing arguments: " + Strings.join(args, ","));
if (args.length == 0)
{
throw new CommandException("Command requires arguments");
}
String sopts = "-:";
LongOpt[] lopts =
{
new LongOpt("noprefix", L... |
bf082443-bc4d-4679-8a82-10c831ed1547 | 0 | public void setFriendlyName(String value) {
this.friendlyName = value;
} |
49b4bed6-770f-4ae2-bb3c-b4dd5db149b0 | 1 | private byte[] nextKeyMix(int length, Collection<String> members) {
byte[] keyMix = new byte[length];
synchronized(keychain) {
for(String alias: members) {
KeyNoncePair knp = keychain.get(alias);
knp.encrypt(keyMix);
}
}
Debugger.println("keys", "[KeyHandler] Station "+ alias+ " has keyMix: " + A... |
50f175e5-08cc-4733-994f-f36286f93b9b | 7 | private static List<String> makePluginNameList(final Map<?, ?> map, final String key) throws InvalidDescriptionException {
final Object value = map.get(key);
if (value == null) {
return ImmutableList.of();
}
final ImmutableList.Builder<String> builder = ImmutableList.<String... |
345bc93a-bfae-4a3b-b4ea-03409bd1dd92 | 0 | protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/expand_group.gif");
return new ImageIcon(url);
} |
0a5abe57-2732-42f4-886c-2a67dcc9fbaf | 8 | private byte getCommandFromMovementKey(int[] acc) {
if(acc[0]==1){
if(acc[2]==1){
return Constants.NORTHWEST;
}
else if(acc[3]==1){
return Constants.NORTHEAST;
}else{
return Constants.NORTH;
}
}
if(acc[1]==1){
if(acc[2]==1){
return Constants.SOUTHWEST;
}
else if(acc[3]==1){... |
d04f04ae-cbc5-4d94-961b-0ad81d8c9e03 | 8 | static void importDirDo() {
boolean success = false;
String lastDir = null;
File[] selectedFiles = null;
if (!isWindows) {
if(folderGetter==null) buildFolderGetter(mainGUI);
int wasGot = folderGetter.showOpenDialog(mainGUI.w);
if (wasGot == JF... |
8ea46122-5c8b-4f39-abb3-3d6a68664f23 | 3 | public static boolean equals(Version v, Version v1)
{
return v.equals(v1) && comparator.compare(v, v1) == 0 || v == null && v1 == null;
} |
6136bddf-a170-4a38-916c-3d91bef22a20 | 3 | @Override
public CategoryModel searchCategoryByName(String name)
throws WebshopAppException {
if (name != null) {
try (Connection conn = getConnection()) {
String sql = "SELECT id, name, staff_responsible "
+ "FROM categories WHERE name = ?";
try (PreparedStatement pstmt = conn.prepareStatement... |
f551d673-4569-42c2-8d98-2e1c045478ed | 5 | * @return
*/
public ArrayList<BiffRec> getCellsByCol( int colNum ) throws CellNotFoundException
{
List<? extends BiffRec> theCells = cellsByCol.get( colNum );
if( theCells.size() == 0 )
{
throw new CellNotFoundException( sheetname, 0, col );
}
Iterator<? extends BiffRec> i = theCells.iterator();
whi... |
3446363a-76c7-4a51-a18f-20542f30a5a3 | 6 | public int getMetadata(int x, int y, int z) {
if(x >= width || x < 0 || y >= height || y < 0 || z < 0 || z >= 10) return 0;
return meta[x][y][z];
} |
947d69c4-b45d-4475-940c-0c30f2fb06b4 | 5 | private boolean lastSixSameDirectionTurn() {
int size = this.prevDirections.size();
if(size < 6) return false;
Direction last = this.prevDirections.get(size - 1);
if(last == Direction.AHEAD || last == Direction.BACK) return false;
for(int preID = 1;preID < 6;preID++){
if(this.prevDirections.get(size - 1 - ... |
6555afd6-886d-46d8-ab1f-f096e8cde7a6 | 2 | @Override
public int hashCode() {
int result;
long temp;
result = saleId;
result = 31 * result + itemId;
result = 31 * result + (name != null ? name.hashCode() : 0);
temp = percent != +0.0d ? Double.doubleToLongBits(percent) : 0L;
result = 31 * result + (int) ... |
b091d7c9-2e8f-4c71-9474-ec477c6e1fea | 6 | int comparePostings(RawPostingList p1, RawPostingList p2) {
if (p1 == p2)
return 0;
final char[] text1 = charPool.buffers[p1.textStart >> DocumentsWriter.CHAR_BLOCK_SHIFT];
int pos1 = p1.textStart & DocumentsWriter.CHAR_BLOCK_MASK;
final char[] text2 = charPool.buffers[p2.textStart >> DocumentsW... |
16725dd2-c5bd-4bd8-8917-452a249df5e3 | 6 | public PreferencePanel(UserPreferences preferences,
final Controller controller) {
super(controller.program.getFrame());
this.controller = controller;
pref = preferences;
pref = preferences;
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
this.setSize((int) ((0.35) * d.width), (int) ((0.55) * ... |
0d1300e0-3d2c-425c-abcf-2c4f07068694 | 8 | public void talk()
{
String s = "All I do Is Win";
if(hoverObjects.size() == 1)
{
for(Object o:hoverObjects)
{
if(o instanceof Bush)
{
s = "I hate Bush";
}
else if(o instanceof Bomb)
{
s = "It's a land mine";
}
else if(o instanceof GumTree)
{
s = "So, this is where Gum comes from?!";
}
else if(o inst... |
62be1374-55c9-4711-bf11-c4eb4991f50e | 1 | public void fireSelectionChangedEvent(JoeTree tree, int type) {
selectionChangedEvent.setTree(tree);
selectionChangedEvent.setType(type);
for (int i = 0, limit = treeSelectionListeners.size(); i < limit; i++) {
((TreeSelectionListener) treeSelectionListeners.get(i)).selectionChanged(selectionChangedEvent);
}... |
e1725281-514c-4dce-942e-b67f5ff8687e | 4 | private Object deserializeJsonElement(JsonElement element) {
if (element.isJsonNull()) {
return null;
} else if (element.isJsonObject()) {
Map<String, Object> valueMap = new HashMap<String, Object>();
populateMapFromJSONObject(valueMap, element.getAsJsonObject());
return valueMap;
} else if (... |
40728e65-cf68-4289-afab-c85d9b5a76ac | 3 | public int Busquedabinaria (int[] arreglo, int elemento){
int inicial=0;
int _final=arreglo.length-1;
while(inicial<=_final){
int central=(inicial+_final)/2;
if(elemento>arreglo[central]){
inicial=central+1;
}
... |
e008585d-a6e4-432b-b8fd-c3d66337665b | 2 | protected int monthNameToInt(String str) {
for (int i = 0; i < months.length; i++)
if (str.equalsIgnoreCase(months[i]))
return i + 1;
return 0;
} |
b1bd7581-d39a-4664-a3df-8caf485fc494 | 1 | @Test
public void transferInstrLOAD_testInvalidMemoryRef() { //Checks LOAD instruction not created with invalid memory ref.
try {
instr = new TransferInstr(Opcode.LOAD, 500, 7);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);
} |
3f78eb56-a8f7-4696-b540-c282e2f36963 | 9 | public ArrayList<ArrayList<Integer>> fourSum(int[] num, int sum) {
ArrayList<ArrayList<Integer>> result = new ArrayList<>();
if(num.length < 4){
return result;
}
quickSort(num, 0, num.length - 1);
Map<Integer, ArrayList<Pair<Integer, Integer>>> map = new HashMap<Integer, ArrayList<Pair<Integer,Integer>>>()... |
e43fd82d-8046-4483-9a04-49a70516387c | 6 | public int getColumnIndex(final String key, final String columnName) {
int idx = -1;
if (key != null && !key.equals(FPConstants.DETAIL_ID) && !key.equals(FPConstants.COL_IDX)) {
idx = xmlRecordElements.get(key).getColumnIndex(columnName);
} else if (key == null || key.equals(FPConsta... |
efc1ade6-61d4-4a72-82f7-a2f8cff9c175 | 2 | public ArrayList<Mob> getMobsInRadius(Entity e, int radius){
ArrayList<Mob> result = new ArrayList<Mob>();
float ex = e.getX();
float ey = e.getY();
for(int i = 0; i < mobs.size(); i++){
Mob entity = mobs.get(i);
float x = entity.getX();
float y = entity.getY();
float dx = Math.abs(x - ex);
float... |
8c82b8e2-df6a-43f9-ad39-8ea856efcff5 | 1 | public void render(){
Color.white.bind();
if(texture == null) texture = tile.getTexture();
texture.bind(); // or GL11.glBind(texture.getTextureID());
// ROTATE ME!!!
double angle = Math.toRadians(degree);
Point center = new Point(x + texture.getImageWidth()/2, y + texture.getImageHeight()/2);
Point ... |
436e5b32-d3a9-4a4a-9ebe-c85a452f3684 | 2 | public Connection getConnection() {
try {
// load driver
Class.forName(driver);
// link to database
Connection conn = DriverManager.getConnection(url, user, pwd);
if (!conn.isClosed())
{
System.out.println("Succeeded connecting to the Database!");
return conn;
}else {
return null;
... |
3f18a103-46ed-4506-812f-15f836bce7d7 | 6 | @EventHandler
public void PlayerFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPlayerConfig().getDouble("Player.Fas... |
3fb16b23-0edf-4146-9677-b5d728c50180 | 8 | public void printRegion(int indent, String line) {
if (options == IMPL_PAREN) {
pw.print("(");
indent++;
}
Enumeration enum_ = childBPs.elements();
int cur = startPos;
BreakPoint child = (BreakPoint) enum_.nextElement();
if (child.startPos >= 0) {
pw.print(line.substring(cur, child.startP... |
ab30ca8e-eda1-43ad-aacf-6dceb5bca66a | 8 | public int getBoardCommentaryCount(int idx) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs =null;
int result = 0;
String sql = "";
try{
conn = getConnection();
sql = "select count(*) from travelcommentary where idx=?";
pstmt = conn.prepareStatement(sql);
p... |
02ce22de-5ddf-4509-a118-77828e247091 | 5 | public void setIcon(ImageIcon Image) {
// Exit early
if (Image == null) {
super.setIcon(null);
return;
}
// Scale the image and add it to the control
int MaxWidth = 100, MaxHeight = 100, Width = Image.getIconWidth(), Height = Image.getIconHeight();
// If the window is ready update MaxWidth and M... |
49d56c2c-5cb1-4269-91c4-bf32e27268e4 | 2 | public int[] deletedItemsIndices(){
if(!this.dataPreprocessed)this.preprocessData();
if(this.nDeletedItems==0){
System.out.println("Method - deletedItemsIndices: there are no deleted items; null returned");
return null;
}
else{
ArrayMaths am1 = new Arr... |
8d63cf47-8df8-472f-9c9f-649943a8ea3f | 6 | public Object getDataForDataSection(DataSection dataSection)
{
if (DATA_SECTION_PIXEL_MAPS == dataSection.getDataSectionName())
{
if (null == terrainNormalMapData) return null;
return null;
// IMPLEMENT: return terrainNormalMapData.getPixelMaps();
... |
73db044e-02ec-4603-81e5-d030280f98b3 | 0 | public int getId() {
return id;
} |
78b19d50-f447-4a25-b328-34b23ff8d79c | 1 | public String toString() {
String[] row_strings = new String[height];
for(int j=0; j<height; j++) {
row_strings[j] = IOGeneric.intListToString(array2d[j], " , ");
}
return IOGeneric.listToString(row_strings, "[;]");
} |
c4177f83-ff76-422a-930f-6f2c06e6a2af | 5 | private void optimizeSector2(){
// Sector 2: 2 more hjs out of GE, FI, POWI, RE/ET
// TODO (maybe): catch Exception (shouldn't actually be possible)
if(myData.subjects[3].writtenExamSubject) return; // Hjs already filled
Subject[] sec2Subjects = new Subject[]{myData.subjects[GESCHICHTE],... |
40bb788a-eafb-406c-95b9-73cdade4fb06 | 4 | private void loadMessages(){
ChatMessage[] tempMessages = dbCon.loadMessages(channel, joinDate);
if(tempMessages != null){
ArrayList<ChatMessage> newMessages = new ArrayList<>(Arrays.asList(tempMessages));
if(chatMessages.size() > 0){
newMessages.removeAll(chatMessages);
}
boolean showTimestamp = Us... |
bfc94900-d48b-439c-a8f9-eff0c395fd97 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (itSerie != null ? itSerie.hashCode() : 0);
return hash;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.