text stringlengths 14 410k | label int32 0 9 |
|---|---|
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... | 6 |
public boolean isRead() {
/* if it is part of a += operator, this is a read. */
return parent != null && parent.getOperatorIndex() != ASSIGN_OP;
} | 1 |
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... | 4 |
@Override
public synchronized void open() throws IOException {
if (isOpen()) {
return;
}
CommPortIdentifier portIdentifier;
CommPort comPort;
Enumeration e = CommPortIdentifier.getPortIdentifiers();
while (e.hasMoreElements()) {
CommPortIdent... | 7 |
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... | 2 |
public static boolean hasAllAttributes(Element element, String[] labels) {
for (String label : labels)
if (!element.hasAttribute(label))
return false;
return true;
} | 2 |
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... | 7 |
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... | 6 |
public static InputStream createInputStream(final File file) throws FileNotFoundException {
if (file == null) {
throw new IllegalArgumentException("null not allowed");
}
return new FileInputStream(file);
} | 1 |
public double[] standardizedPersonTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedPersonTotals;
} | 2 |
public void checkDeclaration(Set declareSet) {
if (initInstr instanceof StoreInstruction
&& (((StoreInstruction) initInstr).getLValue() instanceof LocalStoreOperator)) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo()... | 3 |
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]) {
... | 4 |
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... | 7 |
public void setEventBeanList(ArrayList<EventsBean> eventBeanList) {
this.eventBeanList = eventBeanList;
} | 0 |
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... | 2 |
public void addCharacterIcon(){
ImageCreator charIcon = null;
try {
if (player.getType().equalsIgnoreCase("Warrior")){
charIcon = new ImageCreator("WarriorIcon.jpg");
}
else if (player.getType().equalsIgnoreCase("Marksman")){
charIcon =... | 3 |
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... | 6 |
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... | 4 |
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... | 1 |
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();
} | 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 {
/... | 3 |
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()));
} | 6 |
public void readCSVFileFromDisk(String fullFileNameAndPath, int maxLines){
BufferedReader bufferReader = null;
String line;
String seperator = ",";
int countLines;
try{
bufferReader = new BufferedReader(new FileReader(fullFileNameAndPath));
... | 7 |
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;
} | 3 |
public int compareTo(VersionString arg0) {
if(arg0==null)
throw new NullPointerException("cannot compare VersionString to null");
return compareVersions(version,arg0.toString());
} | 1 |
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... | 3 |
@Override
public void dispose() {
if( !disposed ) {
disposed = true;
disposeDependentItems();
getGraph().removeItem( this );
}
} | 1 |
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 ... | 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... | 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... | 2 |
public void setUsername(String username) {
this.username = username;
} | 0 |
public void update(Pattern p)
{
patternString.getDocument().removeDocumentListener(patternStringListener);
name.getDocument().removeDocumentListener(nameListener);
author.getDocument().removeDocumentListener(authorListener);
width.removeChangeListener(widthListener);
height.removeChangeListener(he... | 8 |
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... | 2 |
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){
... | 6 |
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;
}
} | 2 |
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... | 4 |
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... | 9 |
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 ... | 7 |
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");
... | 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) {
... | 3 |
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.... | 9 |
public Node getOldNode() {
return oldNode;
} | 0 |
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... | 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();
} ... | 6 |
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... | 1 |
@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... | 5 |
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 ... | 7 |
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... | 1 |
@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... | 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... | 4 |
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... | 6 |
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);
}
... | 8 |
@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... | 3 |
@Override
public void remove() {
if (!fjernOK) {
throw new IllegalStateException("Ulovlig tilstand!");
}
fjernOK = false;
if (antall==1) {
hode = hale=null;
antall--;
cursor--;
antallEndringer++;
forven... | 6 |
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;
} | 2 |
String getState() {
return String.valueOf(state);
} | 0 |
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... | 2 |
public ResultSet preencherTabelaEncarregadOTodosdepartamento() throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL... | 6 |
protected void processUserBlocks(List<List<String>> userBlocks) {
if(generateStatistics) {
for(List<String> blockList : userBlocks) {
for(String block : blockList) {
statistics.setPreservedSize(statistics.getPreservedSize() + block.length());
}
}
}
} | 3 |
@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));
... | 6 |
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 =... | 4 |
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... | 3 |
@Override
public void run() {
model.update();
} | 0 |
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... | 7 |
public void setFriendlyName(String value) {
this.friendlyName = value;
} | 0 |
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... | 1 |
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... | 7 |
protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/expand_group.gif");
return new ImageIcon(url);
} | 0 |
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){... | 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... | 8 |
public static boolean equals(Version v, Version v1)
{
return v.equals(v1) && comparator.compare(v, v1) == 0 || v == null && v1 == null;
} | 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... | 3 |
* @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... | 5 |
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];
} | 6 |
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 - ... | 5 |
@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) ... | 2 |
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... | 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) * ... | 6 |
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... | 8 |
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);
}... | 1 |
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 (... | 4 |
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;
}
... | 3 |
protected int monthNameToInt(String str) {
for (int i = 0; i < months.length; i++)
if (str.equalsIgnoreCase(months[i]))
return i + 1;
return 0;
} | 2 |
@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);
} | 1 |
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>>>()... | 9 |
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... | 6 |
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... | 2 |
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 ... | 1 |
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;
... | 2 |
@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... | 6 |
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... | 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... | 8 |
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... | 5 |
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... | 2 |
public Object getDataForDataSection(DataSection dataSection)
{
if (DATA_SECTION_PIXEL_MAPS == dataSection.getDataSectionName())
{
if (null == terrainNormalMapData) return null;
return null;
// IMPLEMENT: return terrainNormalMapData.getPixelMaps();
... | 6 |
public int getId() {
return id;
} | 0 |
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, "[;]");
} | 1 |
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],... | 5 |
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... | 4 |
@Override
public int hashCode() {
int hash = 0;
hash += (itSerie != null ? itSerie.hashCode() : 0);
return hash;
} | 1 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.