text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static String ConvertValueForIndexing(Object value)
{
if (value instanceof String)
return " " + value.toString().toUpperCase();
else if (value instanceof Date)
{
return value.toString();
}
else
{
return value.toString();
}
} | 2 |
@Override
public void fireEvent(UIEvent e) {
super.fireEvent(e);
if(e instanceof ValueChangeEvent) {
processValueChangeEvent((ValueChangeEvent) e);
}
} | 1 |
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/*
* name: username, password
* return: [{"status":"", "reason":"", "data":""}]
*
* request: username, password
* response: status (create a session, insert uId into session)
*/
... | 6 |
public static boolean[] intToBoolean(int[] octets) throws SubneterException
{
if (octets.length != 4)
{
throw new SubneterException("Invalid IP adress too many or to less octets");
}
for (int i = 0; i < 4; i++)
{
if (octets[i] < 0 || octets[i] > 255)
... | 7 |
public void update() {
player.update();
player.checkAttack(enemies);
player.checkCoins(coins);
finish.update();
finish.checkGrab(player);
bg.setPosition(tileMap.getx(), 0);
tileMap.setPosition(
GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety());
... | 6 |
public void test_03() {
System.out.println("\n\nSuffixIndexerNmer: Add test");
String fastqFileName = "tests/short.fastq";
// Create indexer
SuffixIndexerNmer<DnaAndQualitySequence> seqIndexNmer = new SuffixIndexerNmer<DnaAndQualitySequence>(new DnaQualSubsequenceComparator(true), 15);
// Add all sequences ... | 2 |
public void drawBackground(Graphics g) {
// draw the background graphics from the superclass
super.drawBackground(g);
ImageManager im = ImageManager.getSingleton();
Image img;
Position p;
// draw the map as a matrix of tiles with cities on top
for ( int r = 0; r... | 3 |
private void readLimitedInto(HttpURLConnection conn, int limit, ByteArrayOutputStream read) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(getConnectionInputStream(conn)));
String line = null;
while ((line = in.readLine()) != null) {
read.write(line.getBytes());
if (read.s... | 2 |
public static byte[] mapleDecrypt(byte[] data) {
for (int j = 1; j <= 6; j++) {
byte remember = 0;
byte dataLength = (byte) (data.length & 0xFF);
byte nextRemember;
if (j % 2 == 0) {
for (int i = 0; i < data.length; i++) {
byte cur = data[i];
cur -= 0x48;
cur = ((byte) (~cur & 0xFF));
... | 4 |
public static void save(String filename, double[] input) {
// assumes 44,100 samples per second
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
byte[] data = new byte[2 * input.length];
for (int i = 0; i... | 6 |
public void setStart(int start) {this.start = start;} | 0 |
@Override
public String toString() {
if (sb.length() >= delimiter.length())
sb.setLength(sb.length() - delimiter.length());
return sb.toString();
} | 1 |
public static boolean computeCell(boolean[][] world, int col, int row) {
boolean liveCell = getCell(world, col, row);
int neighbours = countNeighbours(world, col, row);
boolean nextCell = false;
if (neighbours < 2)
nextCell = false;
if (liveCell && (neighbours == 2 |... | 7 |
public static void awardBonusInternal() {
BigInteger bonusReduction = BigInteger.valueOf(100);
// To be worked out.
System.out.print("Balances of all accounts (int): ");
for (BankAccount account: christmasBank.getAllAccounts())
System.out.print(" " + account.getBalance(... | 1 |
public List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
if (root == null) {
return result;
}
ArrayList<TreeNode> levelNode = new ArrayList<TreeNode>();
levelNode.add(root);
while (!levelNode.isEmpty(... | 7 |
@Override
public Boolean doStep() {
this.incrementStepNumber();
this.modelLogging("The step " + this.stepNumber + " is starting.\n" +
"The model is:\n", this.steppingModel);
this.notifyStatus("Step " + this.stepNumber + " started");
// ==> Convert the model into a standard linear model if it ... | 7 |
public Character() {
_level = 1;
_health = 0;
_initiative = 0;
_attributes = new Attributes();
_generator = new NormalSpread();
_race = new Deva();
_class = new Ardent();
_classMap = new Vector<>();
_setting = new DnD4e();
BaseGenerator g ... | 5 |
public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLiving)
{
byte var2 = 0;
if (this.worldObj.difficultySetting > 1)
{
if (this.w... | 6 |
public List<List<Integer>> subsets(int[] S) {
List<List<Integer>> ret = new ArrayList<List<Integer>>();
quickSort(S);
int length = S.length;
int[] index = new int[length];
for (int i = 0; i < length; i++) {
index[i] = 0;
}
int currTurnLength = 0;
int eleHave = 0;
int lastTurnIndex = 0;
while (... | 9 |
public Object getValueAt(int row, int col)
{
if (col == ENTITY) { // afficher l'entité dans laquelle la propriété est utilisée (Bug #712439).
return getEntityNameOfProperty(row);
} else {
return rows.get(row)[col];
}
} | 1 |
@SuppressWarnings("unchecked")
public static <VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>>
boolean isBipartite(BaseGraph<VertexType, EdgeType> graph) {
//Copying to ColorableVertex
ColorableVertex<VertexType>[] CVArray = (ColorableVertex<VertexType>[])Array.newInstance(ColorableVertex.c... | 8 |
@Test
public void eventBusNotNull()
{
assertNotNull( eventBus );
} | 0 |
public void open() {
JFileChooser FCdialog = new JFileChooser();
int opt = FCdialog.showOpenDialog(this);
if(opt == JFileChooser.APPROVE_OPTION){
this.textPane.setText("");
try {
this.console.setText("<html> Opening file: "+ FCdialog.getSelectedFile().getName());
Scanner scan = new Scanner(new Fi... | 3 |
private static Enumeration getResources(final ClassLoader loader,
final String name)
{
PrivilegedAction action =
new PrivilegedAction() {
public Object run() {
try {
if (loader != null) {
return ... | 4 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... | 6 |
private Statement Statement(ProcedureBuilder pb) throws Exception {
Statement retval = null;
switch (this.Current_Token) {
case TOK_VAR_STRING:
case TOK_VAR_NUMBER:
case TOK_VAR_BOOL:
retval = ParseVariableDeclStatement(pb);
GetNext();... | 9 |
public boolean validMove(int position, int player){
int[] field = getGameField();
if(field[position] == 0 && this.getTurn() == player){return true;}
else {return false;}
} | 2 |
private SingleTypeFactory(Object typeAdapter, TypeToken<?> exactType, boolean matchRawType,
Class<?> hierarchyType) {
serializer = typeAdapter instanceof JsonSerializer
? (JsonSerializer<?>) typeAdapter
: null;
deserializer = typeAdapter instanceof JsonDeserializer
? (J... | 7 |
@Test
public void testImpossibleMove() {
try {
game = RulesParser.parse("./rules/Chess.xml");
Scanner sc = new Scanner(new File("./test/impossibleMoveBoard.txt"));
//
int xSize = 8;
int ySize = 8;
//
int [][] newField = new int[xSize][ySize];
for (int y = ySize - 1; y > -1; --y) {
for ... | 7 |
public void printPercentages() {
// -- Percentages --
System.out.println(" == Percentages for individual elements ==");
System.out.println();
// Codon percentages
System.out.println(" -- Percentages for each codon composition --");
System.out.println("| - | -AA | ... | 7 |
public void sendGlobalMessage (String sender, String message) {
for (Map.Entry<String, Socket> user : activeSockets.entrySet()) {
if (user.getKey() != sender) {
Socket socket = user.getValue();
try {
PrintWriter out = new PrintWriter(socket.getOutp... | 3 |
private static void writeResourceToFile(
String resourceName, File file) throws IOException
{
if (file == null)
{
throw new NullPointerException("Target file may not be null");
}
if (file.exists())
{
throw new IllegalArgumentException(
... | 8 |
public static void Test()
{
int option=0;
Scanner Input = new Scanner (System.in);
while(option != 3)
{
System.out.println("Fight the Kobold?");
System.out.println("1) Yes");
System.out.println("2) Save Game");
System.out.println("3) exit");
option = Input.nextInt();
if (option == 1)
{
//figh... | 4 |
public String generateQueryString() {
QueryString qs = new QueryString("page", Integer.toString(this.getPage()));
qs.add("limit",Integer.toString(this.getLimit()));
if (this.getKeyword() != null) qs.add("keyword", this.getKeyword());
if (this.getCreatedAtMin() != null) qs.add("created_... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
JTable productsTable = App.getInst().getView().getProductsTable();
JTable categoriesTable = App.getInst().getView().getCategoriesTable();
JComboBox<String> cmb = App.getInst().getView().getCountComboBox();
count = Integer.parseInt((String) cmb.getSelect... | 3 |
private boolean checkUsage(AbstractCommand<P> command, String[] parameters) {
String[] commandParameters = command.getParameters();
int[] limits = new int[2];
for (String parameter : commandParameters) {
limits[1]++;
if (!parameter.matches("\\[.*\\]")) {
limits[0]++;
}
}
return parameters.length ... | 4 |
public void create(CmProfesionales cmProfesionales) {
if (cmProfesionales.getPypAdmControlProfesionalesList() == null) {
cmProfesionales.setPypAdmControlProfesionalesList(new ArrayList<PypAdmControlProfesionales>());
}
EntityManager em = null;
try {
em = getEntity... | 7 |
public void readScores() {
Person second;
Person first;
Person temp;
if (people.size() > 0) {
for (int i = people.size() - 1; i > 0; i--) {
first = people.get(i);
second = people.get(i - 1);
if (first.getScore() > second.getScore()) {
temp = first;
people.set(i, second);
peopl... | 4 |
private void sessionDelete(String cookie_vals){
String[] sTemp = cookie_vals.split("\\^");
String sID = sTemp[0];
int ver = Integer.parseInt(sTemp[1]);
String ipP = sTemp[2].split(":")[0];
int portP = Integer.parseInt(sTemp[2].split(":")[1]);
String ipB = sTemp[3].split(":")[0];
int p... | 4 |
final public Expression Expression(int str_type) throws ParseException {
final Variable v;
final String s;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
v = Variable();
{if (true) return new VariableExpression(v);}
break;
case STRING_END:
case STRIN... | 8 |
public static void main(String[] args)
{
File configPath = new File("AztecConfig.conf");
if ( args.length > 0 )
configPath = new File(args[0]);
if ( !configPath.exists() || !configPath.isFile() || !configPath.canRead() )
{
System.out.println("Unable to open config file: "+configPath.getAbsolutePath());
... | 9 |
public byte[] getQ() {
return q;
} | 0 |
public void act()
{
// spawn ships random
if(Greenfoot.getRandomNumber(10000) < 10) {
addObject(new ship1(), Greenfoot.getRandomNumber(900),10);
}
if(Greenfoot.getRandomNumber(10000) < 10) {
addObject(new ship2(), Greenfoot.getRand... | 4 |
@Before
public void setUp() throws SQLException {
// Setup a simple connection pool of size 10
source = new PGPoolingDataSource();
source.setDataSourceName("Mock DB Source");
source.setServerName("localhost:5432"); // Test server
source.setDatabaseName("MockDB"); // Test DB
... | 7 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((recipes == null) ? 0 : recipes.hashCode());
result = prime * result + toolID;
result = prime * result + ((toolName == null) ? 0 : toolName.h... | 3 |
public void searchByID (LYNXsys system, String query, int page) { // search student by ID
displayedSearchResults.removeAll(displayedSearchResults);
for (int i = 0; i < system.getUsers().size(); i ++) { // loop through arraylist of students
if (system.getUsers().get(i).getID().equalsIgnoreCase(query)){ // check ... | 6 |
Space[] won() {
int n = numToWin - 1;
if (lastSpaceMoved == null)
return null;
int[] pos = lastSpaceMoved.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1] - j) {
boolean outOfBounds = rowInd < 0 || colInd < 0
... | 9 |
public static ButtonImage getTypeFromInt(int index) {
switch (index) {
case 0:
return EMPTY;
case 1:
return ONE;
case 2:
return TWO;
case 3:
return TREE;
case 4:
return FOUR;
case 5:
return FIVE;
case 6:
return SIX;
case 7:
return SEVEN;
case 8:
return EIGHT;
default:
... | 9 |
private static void readFromFile(String filename){
BufferedReader br = null;
String line;
if(filename == null){
System.out.println("No file path specified!");
return;
}
File AddFile = new File(filename);
if(!AddFile.exists())
{
System.out.println("File " + filename + " not found!");
return;
... | 7 |
@Override
public void update(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setColor(Color.gray);
g2.fillRect(0,0,getWidth()... | 9 |
public void setPostNote(String postNote) {
this.postNote = postNote;
} | 0 |
public void mouseRelease(int x, int y){
if(movingInputTime){
movingInputTime = false;
ArrayList<Integer> times = loop.getTimes();
loop.setNewTime(node.getIndex(), (int) node.getTime());
//times.set(node.getIndex(), (int) node.getTime());
System.out.println(times.size());
}
} | 1 |
private void mkCfg () {
for (String qp : qps) {
try {
File h265Cfg = new File("./Cfg/h265/"+seqName+qp+".cfg");
File psvdCfg = new File("./Cfg/psvd/"+seqName+"Residue"+qp+".cfg");
DirMaker.createFile(h265Cfg);
DirMaker.createFile(psvdCf... | 2 |
private void completeCursorMessage() {
Vector<OSCMessage> messageList = new Vector<OSCMessage>();
OSCMessage frameMessage = new OSCMessage("/tuio/2Dcur");
frameMessage.addArgument("fseq");
frameMessage.addArgument(-1);
OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
aliveMessage.addArgument("... | 8 |
public void saveGraphAs(Graph graph, Component c) {
this.graph = graph;
JFileChooser fileChooser = new JFileChooser();
if (graph instanceof PetriNet) {
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Danes Pet... | 6 |
public int[] search (ASEvaluation ASEval, Instances data)
throws Exception {
double best_merit = -Double.MAX_VALUE;
double temp_merit;
BitSet temp_group, best_group=null;
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(ASEval.getClass().getName()
... | 9 |
@Override
public boolean isVisibleAt(int posX, int posY) {
if((posX/zoom) > originX && (posX/zoom) < (originX + width))
if((posY/zoom) > originY && (posY/zoom) < (originY + height))
return true;
return false;
} | 4 |
private static int subStringForAcharAtAnIndex(String s, String set, List<String> subStrings, char ipChar, int index) {
index = s.indexOf(ipChar, index + 1);
int x = 1;
int l = index - x;
int r = index + x + 1;
while (l >= 0 || r <= s.length()) {
l = l < 0 ? 0 : l;
... | 7 |
public String longestCommonPrefix(String[] strs) {
if (strs.length == 0) { // important to check when you are done coding
return "";
}
String first = strs[0];
int i = 0;
char tmp;
while (i < first.length()) {
tmp = first.charAt(i);
for (int j = 1; j < strs.length; j++) {
// the first word may ... | 5 |
public int getValue(int skill)
{
return skillValues[skill];
} | 0 |
public void initResources(Display display) {
if (stockImages == null) {
stockImages = new Image[stockImageLocations.length];
for (int i = 0; i < stockImageLocations.length; ++i) {
Image image = createStockImage(display, stockImageLocations[i]);
if (image == null) {
freeResources();
throw ... | 4 |
@Override
public void run(){
byte[] byteTosend = new byte[1*1024];
try {
for (int k = 0; k < 2/*200000*/; k++) {
nioClientMT.publish(null, byteTosend, "#testtag");
}
} catch (IOException e) {
... | 3 |
public Map<Integer, InventoryItem> GrabFloors()
{
Map<Integer, InventoryItem> Items = new HashMap<Integer, InventoryItem>();
for(InventoryItem Item : this.Inventory.values())
{
if (Item.GrabBaseItem().Type.contains("s"))
{
Items.put(Item.ID, Item);
}
}
return Items;
} | 2 |
@Test
public void testChangeInterfaceOfProperty() throws Exception
{
// connect to database
PersistenceManager pm = new PersistenceManager(driver, database, login, password);
// drop all tables
pm.dropTable(Object.class);
// create test objects
OriginalObject one = new OriginalObject();
one.setValue(1)... | 3 |
@Override
public void execute(Profile profile, String[] args) {
final int RATE = 10;
try {
Twitter twitter = profile.getTwitter();
TwitterBrain brain = profile.getMind();
brain.updateFriends();
logger.info("total friends count: "
+ ... | 6 |
private void processBranches(FileData coverageData, StringBuilder lcov) {
for (Integer lineNumber: coverageData.getBranchData().keySet()) {
List<BranchData> conditions = coverageData.getBranchData().get(lineNumber);
if (conditions != null) {
for (int j = 0; j < conditions... | 6 |
public static boolean addMail(MailItem mail) {
if (!initialised) return false;
Connection connection = null;
PreparedStatement statement = null;
ResultSet result = null;
try {
connection = DriverManager.getConnection(url, username, password);
statement = connection.prepareStatement(INSERT_MESSAGE_COMMAN... | 9 |
public Long getId()
{
return Id;
} | 0 |
public void genererTableau(String fonction, ArrayList<Photographe> listeP, ArrayList<Historien> listeH) {
String entete[] = {"ID", "Choisir " + fonction};
Photographe p;
Historien h;
jTable1.setToolTipText("Double clique pour choisir un utilisateur");
switch (fonction) {
... | 4 |
public void BeginningThisHell(){ //Initialization of Stage objects massive
Judge judge = new Judge();
for (int itanks = 0; itanks < amountTanks; itanks++)
{
tanks[itanks] = new Tank();
for(int i = 0; i < amountStage; i++)
{
stage[... | 3 |
public void viewBoard(Board board) {
int x, y;
String row;
Disc disc;
int[] rowCount = {1,2,3,4,5,6,7,8};
int[] contents = board.getContents();
System.out.println(" A B C D E F G H");
for (y=1; y < BOARD_SIZE+1; y++) {
row = "";
for (x=0; x < BOARD_SIZE+1; x++) {
disc = n... | 8 |
public double getFitness() {
return fitness;
} | 0 |
@SuppressWarnings({"ToArrayCallWithZeroLengthArrayArgument"})
public void testValueCollectionToArray() {
int element_count = 20;
int[] keys = new int[element_count];
String[] vals = new String[element_count];
TIntObjectMap<String> map = new TIntObjectHashMap<String>();
for (... | 6 |
@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 Order)) {
return false;
}
Order other = (Order) object;
if ((this.orderid == null && other.orderid != null) || ... | 5 |
public LocalInfo getReal() {
LocalInfo real = this;
while (real.shadow != null)
real = real.shadow;
return real;
} | 1 |
public static void main(String[] args){
Socket socket;
try {
socket = new Socket("localhost",1457);
//code du client
try
{
Thread.sleep(0);
PrintWriter socketOut = new PrintWriter(socket.getOutputStream(), true);
BufferedReader clavier = new BufferedReader(new InputStreamReader(System.in));
... | 5 |
public static void main(String[] args) {
if (args.length < 1) {
System.out.println(usage);
System.exit(1);
}
int lines = 0;
try {
Class<?> c = Class.forName(args[0]);
Method[] methods = c.getMethods();
Constructor[] constructors = c.getConstructors();
if (args.length == 1) {
int ind... | 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... | 6 |
private static boolean isPalindrome(String s) {
char[] chs = s.toCharArray();
int i = 0;
int j = chs.length - 1;
while (i < j) {
if (!(chs[i] == chs[j])) {
return false;
}
i++;
j--;
}
return true;
} | 2 |
private void afterQueryProcess(Statement statement, Connection connection, ResultSet result) {
try {
if (result != null) {
result.close();
result = null;
}
} catch (SQLException ex) {
}
try {
if (statement != null) {
... | 7 |
public void modifyItem(Item item) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbC... | 4 |
public void setName(String name)
throws ClusterException {
if(name == null || name.equals(""))
throw new ClusterException("The file name of the song cannot be null or empty string");
this.name= name;
} | 2 |
public void placeObject(Objects o) {
for (Player p : Server.playerHandler.players){
if(p != null) {
removeAllObjects(o);
globalObjects.add(o);
Client person = (Client)p;
if(person != null){
if(person.heightLevel == o.getObjectHeight() && o.objectTicks == 0)... | 6 |
public boolean destroyItem(MOB mob, Environmental dropThis, boolean quiet, boolean optimize)
{
String msgstr=null;
final int material=(dropThis instanceof Item)?((Item)dropThis).material():-1;
if(!quiet)
switch(material&RawMaterial.MATERIAL_MASK)
{
case RawMaterial.MATERIAL_LIQUID:
msgstr=L("<S-NAME> po... | 9 |
public static int getMTU() {
Enumeration<NetworkInterface> en = null;
int minMTU = Integer.MAX_VALUE;
try {
en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface ni = en.nextElement();
int mtu = ni.ge... | 4 |
public void paint(Graphics g){
super.paint(g);
this.drawFields(g);
//System.out.println("paint activited");
calender = Calendar.getInstance();
this.drawTime(g);
} | 0 |
public static boolean isInt(String str)
{
if (str == null || "".equalsIgnoreCase(str))
{
return false;
}
for (String n : NUMBERS)
{
if (str.equalsIgnoreCase(n))
{
return true;
}
}
return false;
} | 4 |
public static void main(String[] args) {
EntityManager em = new JPAUtil().getEntityManager();
ContaDAO dao = new ContaDAO(em);
em.getTransaction().begin();
List<Conta> lista = dao.listaContaComGerente();
for (Conta conta : lista){
System.out.println(conta.getTitular());
if(conta.getGerente() != null)... | 2 |
public CurlConnection(String endpoint, String user,String password, String curlCommand,String curlDrop,
String curlURL, String curlUpdate){
Logger log = Logger.getLogger(this.getClass().getName());
log.setLevel(Level.FINE);
this.setLogger(log);
LogHandler.initLogFileHandler(log, "Connection");
this.curlCo... | 1 |
private void readBlocks(Node parent, Automaton root, Set states,
Document document) {
Map i2b = new java.util.HashMap();
addBlocks(parent, root, states, i2b, document);
} | 0 |
private void doUpdate() {
System.out.print("\n[Performing UPDATE] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("UPDATE COFFEES SET PRICE = PRICE + 1");
} catch (SQLException ex) {
System.err.println(ex.getMessage());
}
} | 1 |
public static List qualityList(Enumeration enm)
{
if(enm==null || !enm.hasMoreElements())
return Collections.EMPTY_LIST;
Object list=null;
Object qual=null;
// Assume list will be well ordered and just add nonzero
while(enm.hasMoreElements())
{
... | 7 |
public Point[] findKClosestPoints(Point[] points, int k, final Point origin) {
if (points == null || points.length == 0 || points.length < k) {
return points;
}
Point[] result = new Point[k];
PriorityQueue<Point> queue = new PriorityQueue<Point>(k, new Comparator<Point>() {
@Override
public int c... | 8 |
private void download(URL url, File file, int size)
{
System.out.println("Downloading: " + file.getName() + "...");
//minecraft.progressBar.setText(file.getName());
DataInputStream in = null;
DataOutputStream out = null;
try
{
byte[] data = new byte[4096];
in = new DataInputStream(url.openStream(... | 7 |
private static void writeTrace(final Trace trace, final int traceId,
final JsonGenerator generator) throws IOException
{
generator.writeStartObject();
generator.writeNumberField(JsonTraceCodec.TRACE_ID, traceId);
generator.writeStringField(JsonTraceCodec.TRACE_NAME, trace.... | 7 |
public static void main(String[] args) {
Heap h = Heap.make(S);
for (int i=0; i<N; i++) {
System.out.println("Allocating object " + i
+ " at address " + h.alloc(8));
}
h.dump();
System.out.println("Free space remaining = " + h.freeSpace());
} | 1 |
public SignatureVisitor visitClassBound() {
if (state != FORMAL) {
throw new IllegalStateException();
}
state = BOUND;
SignatureVisitor v = sv == null ? null : sv.visitClassBound();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} | 2 |
public byte[] getGenotypesScores() {
int numSamples = getVcfFileIterator().getVcfHeader().getSampleNames().size();
// Not compressed? Parse codes
if (!isCompressedGenotypes()) {
byte gt[] = new byte[numSamples];
int idx = 0;
for (VcfGenotype vgt : getVcfGenotypes())
gt[idx++] = (byte) vgt.getGenoty... | 2 |
private Point searchSpace(Rectangle bounds, int sides, int i, double p)
{
// The bounds of the string
int str_X = bounds.width;
int str_Y = bounds.height;
str_Y = bounds.height;
int x=(int)(p*width);
int l = 0;
while (x > 0 && x< width - str_X)
{
int k = 0;
int y= p_cen.y;
while (y > 0 &&... | 7 |
@Override
public FunctionEvaluator getClone() {
TabularFunction clonedT = new TabularFunction();
for (NodeVariable parameter : this.getParameters()) {
clonedT.addParameter(parameter);
}
if (debug >= 2) {
String dmethod = Thread.currentThread().getStackTra... | 5 |
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.