text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void CompileShader()
{
glLinkProgram(m_resource.GetProgram());
if(glGetProgrami(m_resource.GetProgram(), GL_LINK_STATUS) == 0)
{
System.err.println(glGetProgramInfoLog(m_resource.GetProgram(), 1024));
System.exit(1);
}
glValidateProgram(m_resource.GetProgram());
if(glGetProgrami(m_re... | 2 |
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj)
{
if (obj instanceof Tuple<?,?>) {
if(x.equals(((Tuple<X,Y>)obj).x) && y.equals(((Tuple<X,Y>)obj).y))
{
return true;
}
}
return false;
} | 5 |
public void action(Player player, boolean doublePay) {
if(getOwner() != null && !player.equals(getOwner()) && doublePay && !isInMortgage()) {
player.pay(getBill(player) * 2);
getOwner().addMoney(getBill(player) * 2);
} else {
action(player);
}
} | 4 |
public MaxAmountIterableClass() {
IterableWithAnnot = new ArrayList<String>();
IterableWithoutAnnot = new ArrayList<String>();
int i = 0;
while (i < 6) {
IterableWithAnnot.add("e" + i);
IterableWithoutAnnot.add(i, "e" + i);
i++;
}
} | 1 |
public OMLFileFormat() {
super();
} | 0 |
public static String formatDurationWords(
long durationMillis,
boolean suppressLeadingZeroElements,
boolean suppressTrailingZeroElements) {
// This method is generally replacable by the format method, but
// there are a series of tweaks and special cases that require
/... | 9 |
private void addCatchers(BasicBlock[] blocks, ExceptionTable et)
throws BadBytecode
{
if (et == null)
return;
int i = et.size();
while (--i >= 0) {
BasicBlock handler = find(blocks, et.handlerPc(i));
int start = et.... | 5 |
public void loadGame(JFrame frame) {
JFileChooser fileChooser = new JFileChooser(".");
int result = fileChooser.showOpenDialog(frame);
if (result == JFileChooser.APPROVE_OPTION) {
try {
FileInputStream fis = new FileInputStream(
fileChooser.get... | 5 |
public void applyNews(){
News item = news.pop();
appliedNews.add(item);
String[] tags = item.getTags();
for (int i = 0; i < tags.length; i++){
String searching = tags[i];
for (int j = 0; j < stocks.size(); j++){
Stock checking = stocks.get(j);
String tick = checking.getTicker();
if (searching.equa... | 3 |
public void sortBySuit() {
ArrayList newHand = new ArrayList();
while (hand.size() > 0) {
int pos = 0; // Position of minimal card.
Card c = (Card)hand.get(0); // Minimal card.
for (int i = 1; i < hand.size(); i++) {
Card c1 = (Card)hand.get(i);
if ( c1.g... | 5 |
public static String complete(String main, int start) {
String[] args = main.split(" ");
StringBuilder string = new StringBuilder();
for (int i = start; i < args.length; i++) {
string.append(args[i] + " ");
}
return string.toString().substring(0, string.length() - 1);
} | 1 |
public int get (K key, int defaultValue) {
int hashCode = key.hashCode();
int index = hashCode & mask;
if (!key.equals(keyTable[index])) {
index = hash2(hashCode);
if (!key.equals(keyTable[index])) {
index = hash3(hashCode);
if (!key.equals(keyTable[index])) return getStash(key, defaultValue);
}
... | 3 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextLine()) {
String b = in.nextLine().trim();
if (b.equals("0") ) break;
int sum = 0;
for(int i = 0;i < b.length();i++) {
sum += (b.charAt(i) - '0');
}
while ( sum >= 10 ) {
int a = sum % 10;
wh... | 5 |
protected void handleView(final View view) {
List<Address> new_mbrs=null;
if(local_view != null)
new_mbrs=Util.newMembers(local_view.getMembers(), view.getMembers());
local_view=view;
coord=view.getMembers().iterator().next();
boolean create_bridge=false;
boo... | 7 |
Deserializer_3(@SuppressWarnings("hiding") final SongData sdc) {
super(sdc);
final String entry = this.idx.getFilename().replace(".idx", "")
.replace(".zip", "");
this.inFile = this.idx.resolve("..", entry);
this.tmp = this.idx.getParent().resolve(entry + ".tmp");
final Set<String> zip = this.io.openZipIn... | 4 |
public void learn(DataPoint dp) {
/* Properly set all neurons. */
/* Calculate the constant part of the derivative. */
double precomputed = 2*(dp.getExpected() - outputNeuron.evaluate());
/* Modify weights. */
outputNeuron.setBias(outputNeuron.getBias()+
alpha*preco... | 1 |
public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} | 3 |
public void update(int delta, boolean onBeat, int bpm) {
if (onBeat) {
lastFire++;
if (lastFire % beatsPerEmission == 0) {
if (projectileCount == 1) {
projectiles.add(emitProjectile(bpm, directionMin));
} else {
int dirDiff = (directionMax - directionMin)
/ projectileCount;
for (i... | 4 |
public static String getVariableType(String s) {
s = s.toLowerCase();
if (s.equals("i")) {
return "int";
} else if (s.equals("l")) {
return "long";
} else if (s.equals("s")) {
return "short";
} else if (s.equals("b")) {
return "byte";
} else if (s.equals("c")) {
return "char";
} else if (s.... | 8 |
public void delete()
{
if(isReadOnly()) return;
try { fdbf.seek( recordpos() ); } catch (IOException e) {}
writeChars(0,1,"*"); deleted = true;
} | 2 |
private boolean generate(Painter painter, int resolutionX, int resolutionY, String filename, String imgformat) {
// create a buffered image object using RGB+A pixel format
BufferedImage image = new BufferedImage(resolutionX, resolutionY, BufferedImage.TYPE_INT_ARGB);
// Set a color for each pixel. Y pi... | 3 |
public void save() {
try {
sql.Query.save(this);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
} | 2 |
public static Supply createRandomSupply(Position pos){
Supply s;
int random=(int) (Math.random()*100);
if (random<33){
s=createRandomAmmo(pos);
} else if (random < 66){
s=createRandomFood(pos);
} else {
s=createRandomHealth(pos);
}
return s;
} | 2 |
@EventHandler
private void onInventoryClickEvent(InventoryClickEvent event)
{
Player player = (Player) event.getWhoClicked();
//Make sure that the player is being watched before continuing
if (!InventoryMenuManager.isPlayerWatched(player))
return;
//Cancel the event to prevent players from adding/removin... | 6 |
private boolean check(int row, int col, int[][] columnForRow) {
for (int i = 0; i < row; i++)
if (columnForRow[i][col] == 1)
return false;
// 右对角线(只需要判断对角线上半部分,因为后面的行还没有开始放置)
for (int i = row - 1, j = col - 1; i >= 0 && j >= 0; i--, j--)
if (columnForRow[i][j] == 1)
return false;
// 左对角线(只需要判断对角线上... | 8 |
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player p = e.getEntity();
if (p.getKiller() instanceof Player) {
Player killer = p.getKiller();
if (CTF.gm.isPlaying(p)) {
p.setFireTicks(0);
p.setHealth(20.0);
CTF.lh.tele... | 7 |
private boolean aDown(int x){
boolean ret = false;
for (int i =3; i > 0 ; i--){
if (grid.get(i).get(x) != null && grid.get(i-1).get(x)!= null){
if (grid.get(i).get(x).getValue() == grid.get(i-1).get(x).getValue()){
//ADDING
grid.get(i).get(x).addValue(grid.get(i-1).get(x).getValue());
//NULLI... | 6 |
private TableColumn<Object, ?> getNextColumn(boolean forward) {
List<TableColumn<Object, ?>> columns = new ArrayList<>();
for (TableColumn<Object, ?> column : getTableView().getColumns()) {
columns.addAll(getLeaves(column));
}
//There is no other column that supports editing.... | 8 |
private long getPosition(int length){
long bestPos = 0;
int bestLeng = 0;
for (Long pos : freePointers.keySet()){
int leng = freePointers.get(pos);
if (length <= leng){
if (bestLeng == 0 || bestLeng > leng){
bestLeng = leng;
... | 5 |
public void setCharacter(int character)
{
this.character = character;
} | 0 |
public void putAll(Map other) {
if (!(other instanceof CoordinateMap))
return;
CoordinateMap coords = (CoordinateMap) other;
if (!this.ofSameType(coords))
return;
for (CoordinateEntry entry : coords.data)
this.put(entry);
} | 3 |
public static void main(String[] args)
{
try
{
//////////////////////////////////////////
// Step 1: Initialize the GridSim package. It should be called
// before creating any entities. We can't run this example without
// initializing GridSim first. W... | 6 |
public TreeNode findSubTree(int start,int end,int[] array){
if(end - start < 0 ){
return null;
}
else{
TreeNode root = null;
int mid = (start +end) /2;
root = new TreeNode(array[mid]);
root.left = findSubTree(start,mid-1,array);
... | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DataWrapper other = (DataWrapper) obj;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value)... | 6 |
public boolean isValidMove(int startCol, int startRow, int endCol, int endRow)
{
final int MAXBOUNDS = 8;
return ((startRow == endRow && Math.abs(startCol - endCol) <= MAXBOUNDS) || (startCol == endCol && Math.abs(startRow - endRow) <= MAXBOUNDS) ||
(endCol != startCol && startRow != endRow && (Math.abs(end... | 6 |
private void inputFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputFieldFocusGained
if ("Type your message here...".equals(inputField.getText()) && inputField.getFont() == fontI) {
inputField.setFont(fontD);
inputField.setText("");
}
inputField.setF... | 2 |
@Override
public void lockFile(FileHandle handle, long byteOffset, long length)
throws PathNotFoundException, AccessDeniedException,
NotAFileException, UnsupportedFeatureException, AlreadyLockedException {
if (hardlinks)
{
if (RedirectedFileHandle.class.isInstance(handle))
{
handle = ((RedirectedF... | 4 |
public static DaoFactory getFactory() throws DaoException {
if (factory == null) {
factory = new XmlDaoFactory();
// factory = Class.forName("org.training.d4.dao.xml.XmlDaoFactory");
}
return factory;
} | 1 |
private static String before(String s){
//System.out.println("befoe input"+s);
int closed=0;
int countdownIndex=0;
int i=s.length()-1;
//gets an xtra char but thts alright i hope
for (;i>=0&&countdownIndex==0;i--){
if(s.charAt(i)==']'){
closed++;
countdownIndex=i;
}
}
int x=countdownIndex-... | 9 |
private void getCertificate() throws IOException
{
try
{
SavingTrustManager tm = openSocketWithCert();
// Try to handshake the socket
boolean success = false;
try
{
sslsocket.startHandshake();
success = true;
}
catch (SSLException e)
{
sslsocket.close();
}
// If we... | 5 |
public GameObject getObject(int x, int y) {
if (x >= Realm.WORLD_WIDTH || y >= Realm.WORLD_HEIGHT || x < 0 || y < 0){
return null;
}
return scenobjects[x][y];
} | 4 |
private void setSpots(int r, int c, int spots, String color) {
if (!_board.exists(r, c)) {
throw error("board does not exist at %d %d", r , c);
}
if (spots < 0) {
throw error("can only set a nonnegative number of spots");
}
if (spots <= _board.neighbors(r... | 6 |
@Override
public void draw(Graphics g){
if (state ==1){
//<editor-fold defaultstate="collapsed" desc="SAT Polygon vs. Circle Test">
cam.applyCamera(g);
g.setColor(Color.WHITE.getRGB());
Vector2D point = cam.projectPoint(new Vector2D(Mouse... | 9 |
public boolean isEdgeInArea(Point p1, Point p2) {
double x1 = p1.getX();
double y1 = p1.getY();
double x2 = p2.getX();
double y2 = p2.getY();
if (x1 > x2) {
double temp = x1;
x1 = x2;
x2 = temp;
}
if (y1 > y2) {
double temp = y1;
y1 = y2;
y2 = temp;
}
if (getCenterX() >= x1 && getC... | 6 |
public Bank() {
setTitle("Bank Application");
//remove all listener that we have first
for (ActionListener al : JButton_PerAC.getActionListeners()) {
JButton_PerAC.removeActionListener(al);
}
for (ActionListener al : JButton_CompAC.getActionListeners()) {
... | 4 |
private int remap(final int var, final Type type) {
if (var + type.getSize() <= firstLocal) {
return var;
}
int key = 2 * var + type.getSize() - 1;
int size = mapping.length;
if (key >= size) {
int[] newMapping = new int[Math.max(2 * size, key + 1)];
System.arraycopy(mapping, 0, newMapping, 0, size);... | 4 |
@Override
public void removeItem(String item) {
try {
fTPConnector.deleteFile(item);
items.remove(item);
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
} | 1 |
@Override
public void refreshView(Graphics2D g2d) {
List<Shape> shapes = shapeManager.getShapes();
for (Shape s : shapes) {
if (s instanceof Rectangle)
drawRectangle(g2d, (Rectangle)s);
if (s instanceof Square)
drawSquare(g2d, (Square)s);
if (s instanceof Line)
drawLine(g2d, (Line)s);
if ... | 9 |
private static void testVarkaDemote(L2PcInstance player)
{
if (player.isAlliedWithVarka())
{
// Drop the alliance (old friends become aggro).
player.setAllianceWithVarkaKetra(0);
final PcInventory inventory = player.getInventory();
// Drop by 1 the level of that alliance (symbolized by a quest ... | 6 |
public void setTelefon(String telefon) {
this.telefon = telefon;
} | 0 |
@Override
protected void solidifyComponent() {
slots = new Slot[this.getNumSubComponents()];
for (int i = 0; i < slots.length; i++) {
slots[i] = new Slot();
slots[i].setSize(componentSize, componentSize);
if (this.getSubComponent(i) != null) {
slot... | 3 |
static final void method3230(int[] is, int[] is_1_, int i) {
try {
anInt9606++;
if (is == null || is_1_ == null) {
Class348_Sub40_Sub6.aByteArrayArrayArray9134 = null;
Class190.anIntArray2552 = null;
Class59_Sub2_Sub2.anIntArray8684 = null;
} else {
Class59_Sub2_Sub2.anIntArray8684 = is;
Class... | 6 |
public void testGetArg2() {
System.out.println("\n**** testGetArg2 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CONNECTION) {
... | 7 |
public static Priority valueOf(int v) {
switch (v) {
case 1:
return HIGH;
case 2:
return MEDIUM;
case 3:
return LOW;
default:
throw new IllegalArgumentException("priority out of range");
}
} | 3 |
public void populationInfer() {
// TODO Auto-generated method stub
debugPrint.print("Starting Population Inference Engine step", 5);
/*Setup data strucutre to pass to Yifang's code*/
HashMap<String, HashMap<String, HashSet<String>>> data = new HashMap<String, HashMap<String, HashSet<String>>>();
//<User ID... | 9 |
public static int cmpSrcMaj(final int[] buffer, final int first, final int second) {
//
if (buffer[first + IDX_SRC] < buffer[second + IDX_SRC]) return SMALLER;
if (buffer[first + IDX_SRC] > buffer[second + IDX_SRC]) return BIGGER;
if (buffer[first + IDX_DST] < buffer[second + IDX_DST]) r... | 4 |
public void setTableFieldString(String tableFieldString) {
this.tableFieldString = tableFieldString;
} | 0 |
public void move(StringBuffer output) throws EndGameException {
Direction directionToMove = getDirectionToMove(); //directionToMove should be crossable
if(myPosition.isCrossable(directionToMove)){
if (myPosition.hasCharacter(directionToMove))//attack
{
Character defender= myPosition.getCharacter(direc... | 4 |
public void setObtained(boolean value) {
this.obtained = value;
} | 0 |
private void appendFriendlyClassName(StringBuilder sb, Class<?> cl) {
if (cl == null) {
sb.append(cl);
return;
}
if (cl.isPrimitive()) {
sb.append(cl.getName());
} else if (cl.isArray()) {
appendFriendlyClassName(sb, cl.getComponentType());... | 9 |
public static void mouseExited(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while(it.hasNext()) {
PComponent comp = it.next();
if(comp == null)
continue;
if (shouldHandleMouse) {
if (comp.shouldHandleMouse()... | 8 |
public Product inputProduct() {
Product product = null;
String reply = keyboard("Select product (y - Yes, n - No)");
if (reply.equals("y")) {
product = selectProduct();
}
if (product != null) {
return product;
}
String typeOfTheProduct = ... | 7 |
public static void main(String args[]) {
Thread t = new Thread(() -> {
while (true) {
// updateBalance(); //use synchronized
updateBalance2(); // don't use synchronized
}
});
t.start();
t = new Thread(() -> {
while (true) {
monitorBalance();
}
});
t.start();
} | 2 |
public static void GenerateReport()
{
System.out.println("The term is finally done! Lets see how Damon did this term.");
DamonMarksReport();
DamonGamingReport();
DamonSportsReport();
} | 0 |
public static List<ITileObject> loadMap(String file)
{
try
{
InputStream stream = MapLoader.class.getClassLoader().getResourceAsStream("res/maps/" + file);
BufferedImage bufferedImage = ImageIO.read(stream);
final byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
... | 6 |
@Override
public boolean equals(Object obj2) {
if (obj2 instanceof Token) {
Token tok2 = (Token) obj2;
if (this.value.getClass() != tok2.value.getClass()) {
return false;
}
if (this.count != tok2.count) {
... | 5 |
public ListNode reverseKGroup(ListNode head, int k) {
ListNode header = new ListNode(0);
header.next = head;
ListNode[] nodes = new ListNode[k];
int count = 0;
ListNode pre = header;
ListNode p = head;
while (p!=null){
while(p!=... | 7 |
public void setCell(int x, int y, Cell cell) {
this.cells[x][y] = cell;
} | 0 |
public static boolean wasKeyReleased(char c) {
if (!keyrCheckInitiated) {
keyrCheckInitiated = true;
keyrLastUpdate = System.currentTimeMillis();
}
if (keyrLastUpdate + TIMEOUT < System.currentTimeMillis()) {
app.keysReleased.clear();
}
Character n = new Character(c);
try {
... | 5 |
public void setIn(Node node, Object o)
{
if(this.in == null)
{
this.in = new Hashtable<Node,Object>(1);
}
if(o != null)
{
this.in.put(node, o);
}
else
{
this.in.remove(node);
}
} | 2 |
public void createPartControl(Composite frame) {
final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());
GridLayout layout = new GridLayout();
layout.numColumns = 3;
frame.setLayout(layout);
String platform = SWT.getPlatform();
String helpKey = "F1";
if (platform.equals("gtk")) helpKey =... | 6 |
@Override
public boolean InitBase(int ptra_v2m) {
int d = 0;
m_base.timediv = v2mBuffer.getInt(d); //System.out.println(m_base.timediv);
m_base.timediv2 = 10000 * m_base.timediv; //System.out.println(m_base.timediv2);
m_base.maxtime = v2mBuffer.getInt(d + 4); //System.out.println(m_base.maxtime);
m_base.gdnu... | 9 |
public boolean isPalindrome(int x) {
if(x < 0)
return false;
int y=0;
int val = x;
while(val > 0){
y = y*10+ (val % 10 );
val = val /10;
}
return y == x;
} | 2 |
public static List<?> arrayToList(Object source) {
return Arrays.asList(SpringObjectUtils.toObjectArray(source));
} | 1 |
private boolean doAction(final String action, final SceneObject obj) {
if(Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) {
if(obj.getLocation().distanceTo() > 5) {
Walking.walk(obj.getLocation());
} else {
if(!obj.isOnScreen()) {
Camera.turnTo(obj);
} else {
if(... | 7 |
public Provider() { this.products = new HashMap<>(); } | 0 |
public void lopetaTaso() {
this.osuikoJohonkin = EsteenTyyppi.QUIT;
} | 0 |
private boolean vecInList(ArrayList<Node> list, Vector2 vector){
for(Node n : list) {
if(n.tile.x == vector.x && n.tile.y == vector.y) return true;
}
return false;
} | 3 |
public String render(){
String s = "";
//keep track of whether the previous part of the term was wrapped with parentheses
//this is so we can distinguish between 62 and 6(2), etc.
boolean prevHadPar = true;
String prevClass = "";//the name of the class of the previous part of the term
for(int i = 0; i < thi... | 9 |
private void fullStrize(){
for(int i = 0; i<n;i++)
stroki[i]=new Stroka(A[i]);
stolbiki = new Stolbec[m];
for(int i=0; i<m;i++)
{
stolbiki[i] = new Stolbec(n);
for(int j=0; j<n; j++){
stolbiki[i].setone(j, stroki[j].get(i) );
... | 3 |
private Color interpolateColor(final Stop LOWER_BOUND, final Stop UPPER_BOUND, final double POSITION) {
final double POS = (POSITION - LOWER_BOUND.getOffset()) / (UPPER_BOUND.getOffset() - LOWER_BOUND.getOffset());
final double DELTA_RED = (UPPER_BOUND.getColor().getRed() - LOWER_BOUND.getColo... | 8 |
public static void main(String[] args) {
EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(1(01*0)*1|0)*");
int solutionFoundCounter = 0;
int noSolutionFound = 0;
List<Long> cycleCount = new LinkedList<Long>();
... | 8 |
@Override
public AssertionResult getResult(SampleResult samplerResult)
{
AssertionResult result = new AssertionResult(getName());
byte[] responseData = samplerResult.getResponseData();
if (responseData.length == 0) {
return result.setResultForNull();
}
if (isJsonValidation())
{
try
{
if (... | 9 |
public static int[] Verprofit(int[] prices) {
int len = prices.length;
int max = prices[len-1];
int maxPosition = len;
int min = prices[len-1];
int minPosition = len;
int lastPoint = prices[len-1];
int newMax = -1;
int newMaxPosition = -1;
int[] result = new int[len+1];
result[len] = 0;
result[len... | 7 |
@Test
public void heapTest(){
long start = System.currentTimeMillis();
for (int i = 0; i < 1000000; i++){
binaryheap.insert(i);
}
for (int i = 0; i < 1000000; i++){
binaryheap.delete();
}
long end = System.currentTimeMillis();
... | 2 |
public void acceptCmd(UUID idClient, byte[] data) {
int index = getIndex(data);
byte cmd = getCmd(data);
if (index < 0 || index >= locks.keySet().size()) {
if (!send(idClient, false)) error("acceptCmd", "failed to send fail to client: " + idClient);
} else if (cmd == 0 && (locks.get(index).peek() == null ... | 8 |
public static Color getCurrentSecondary(ColorType c) {
if (c == ColorType.WALL || c == ColorType.SLOW_WALL)
if (beatCount % 2 == 0)
return getAltSecondary();
return SECONDARY_COLOR_MAP.get(getColor(c));
} | 3 |
public static void printlocOutDegVsWheightedMeanPersonSocScore(){
HashMap<Integer,Integer> outDegree = new HashMap<Integer,Integer>(numLocations);
HashMap<Integer,Double> meanSoc = new HashMap<Integer,Double>(numLocations);
try {
Connection con = dbConnect();
Statement getOutDeg = con.createStatement();
... | 7 |
public int sum(String inputNumbers) {
if (inputNumbers.isEmpty())
return 0;
else {
return sumNumbers(parseInput(inputNumbers));
}
} | 1 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
private float[] popFloatArray() throws PDFParseException {
Object obj = stack.pop();
if (!(obj instanceof Object[])) {
throw new PDFParseException("Expected an [array] here.");
}
Object[] source = (Object[]) obj;
float[] ary = new float[source.length];
for (in... | 3 |
private boolean isLinked(File file, List<File> list) {
String s = file.getName();
BufferedReader br = null;
String line;
for (File f : list) {
if (!f.equals(file)) {
try {
br = new BufferedReader(new FileReader(f));
line = br.readLine();
while (line != null) {
if (line.indexOf(s) != ... | 7 |
public int getNumberOfMarkerOwners(String matchName){
try {
cs = con.prepareCall("{ call GET_MARKEROWNERCOUNT(?,?) }");
cs.setString(1, matchName);
cs.registerOutParameter(2, Types.INTEGER);
cs.executeQuery();
//System.out.println("number of players in team: " + cs.getInt(3));
return cs.getInt(2);
... | 1 |
public TransactionSet findKItemSubsets(ItemSet itemSet, int k) {
TransactionSet allSubsets = new TransactionSet();/*New subset of transactions to return in a TransactionSet*/
int subsetCount = (int) Math.pow(2, itemSet.getItemSet().size());/*index control for loop*/
int itemSetSize = itemSet.getItemSet().size();/... | 5 |
public void actionPerformed(ActionEvent e) {
result = new StringBuilder();
try {
String patternText = patternMatcher.patternText();
MatcherPreferences.storePatternText(patternText);
final List<String> testStringTexts = patternMatcher
.testStringTexts();
for (int i = 0, n = testStringTexts.si... | 8 |
private static void playAgainstOpponentOnServer(int gameId, int color, int teamNumber, String secret) {
PlayChess ourTeam = new PlayChess(color, gameId, teamNumber, secret);
while (true) {
System.out.println("POLLING AND MOVING FOR " + color);
Response r = ourTeam.poll();
System.out.println(r);
if (ourT... | 5 |
public boolean hasHepatitis(String player) {
String query = "SELECT * FROM nosecandy WHERE hepatitis='1';";
ResultSet result = null;
result = this.sqlite.query(query);
boolean hepatitis = false;
try {
if (result != null && result.next()) {
hepatitis = result.getBoolean(Column.HEPATITIS.getName());
}... | 3 |
public static int calculatePreferredHeight(FontMetrics fm, int maxWidth,
String text) {
if("".equals(text)) {
return 0;
}
// utility that helps us to break the lines
final BreakIterator bi = BreakIterator.getLineInstance();
bi.setText(text);
int lineCount = 0;
final int lineHeig... | 4 |
public static void startupHtmlUtilities() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTE... | 6 |
public void shouldBeEqual(PrintWriter oo, Heaper original, Heaper imported, Heaper importedAgain) {
boolean oi;
boolean oa;
boolean ia;
oi = original.isEqual(imported);
oa = original.isEqual(importedAgain);
ia = imported.isEqual(importedAgain);
if (oi && ( ! oa && ( ! ia))) {
oo.print("2nd import ");
oo.prin... | 9 |
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.