text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static Scanner scannerForWebPage(String page) {
try {
String filename = page.substring(page.lastIndexOf('/')+1);
File local = new File(filename);
if (local.isFile()) return new Scanner(local);
URL u = new URL(page);
FileOutputStream save = new FileOutputStream(local);
InputStream read = u.ope... | 3 |
private T NextLargestRec(T key, BTPosition<T> node) {
T found = null;
if (node.getLeft() != null) {
found = NextLargestRec(key, node.getLeft());
}
if (comp.compare(node.element(), key) > 0 && found == null) {
found = node.element();
}
if (node.getRight() != null && found == null) {
found = Next... | 5 |
@Override
public List<Map<String, ?>> Fotos_usuario(String idtr,String tipo) {
List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>();
String tabla ;
if(tipo.equals("todo")){
tabla ="rhth_fotos_trabajador";
}else{
tabla ="rhtr_fotos_trabajado... | 8 |
public boolean processMsg(CConnection cc) {
OutStream os = cc.getOutStream();
StringBuffer username = new StringBuffer();
StringBuffer password = new StringBuffer();
// JW: Launcher passes in username and password as properties of Options object,
// so there's no need to pop up a dialog asking for... | 5 |
public List<Entry> processData(Document doc) {
List<Entry> entryList = new ArrayList<>();
List<String> scriptures = new ArrayList<>();
List<String> topic = new ArrayList<>();
String date;
String content = null;
String scrip;
NodeList entry = doc.getEl... | 9 |
public Array<Warp> createWarps(){
Array<Warp> warps = new Array<>();
MapProperties prop = tileMap.getProperties();
//create right warp
if(prop.get("next")!=null) {
String next = prop.get("next", String.class);
String nextWarp = prop.get("nextWarp", String.class);
int nextID = 0;
if(nextWarp!=null)... | 9 |
public Object [][] getDatos(){
Object[][] data = new String[getCantidadElementos()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... | 5 |
public static void startupWebtoolsSystem() {
synchronized (Stella.$BOOTSTRAP_LOCK$) {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.systemStartedUpP("stella", "/STELLA"))) {
StartupStellaSystem.startupStellaSystem();
}
}
if (Stella.currentStartupTimePhaseP(1)) {
... | 9 |
public static boolean isSection(String line){
if(line.charAt(0) == '[' && line.charAt(line.length() - 1) == ']'){
return true;
}
return false;
} | 2 |
public String next()
{
if(console)
advance();
String ret = token;
String temp = line;
if(!console)
advance();
if(temp.equals(line))
line = line.substring(ret.length()).trim();
return ret;
} | 3 |
@Override
public User getUser() {
return user;
} | 0 |
@Override
public void run() {
try {
this.out = new DataOutputStream(socket.getOutputStream());
this.in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "US-ASCII"));
finishFlag = false;
while(!finishFlag) { ... | 4 |
public void addLocus(Locus newLocus) throws Exception {
double tolerance = 1.0e-7;
newLocus.setChrom(this);
if (newLocus.getPosition()<headPos) {
if (newLocus.getPosition()<headPos-tolerance) {
throw new Exception("addLocus: position invalid");
}
... | 7 |
private void executeRemoving() {
if (action.contains("rooms")) {
}
else if (action.contains("corridors")) {
}
else if (action.contains("inner yards")) {
}
} | 3 |
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 void optimizeParam(int numItns) {
assert wordTopicHist != null;
// update histograms
int njMax = wordTopicCountsNorm[0];
for (int j=1; j<T; j++)
if (wordTopicCountsNorm[j] > njMax)
njMax = wordTopicCountsNorm[j];
wordTopicNormHist = new int[njMax + 1];
for (int j=0; j<... | 8 |
public void mouseReleased(MouseEvent e)
{
} | 0 |
private void reloadBoardType(BoardTypeEnum myBoardType) {
String[] boardTypes = comboBoard.getItems();
String label = myBoardType.getLabel();
for (int index = 0; index < boardTypes.length; index++) {
if (label.equals(boardTypes[index])) {
comboBoard.select(index);
... | 2 |
public static List<Integer> makeEratosthenesSieve() {
List<Integer> primes = new ArrayList<Integer>();
int upperBound = 10000;
int upperBoundSquareRoot = (int) Math.sqrt(upperBound);
boolean[] isComposite = new boolean[upperBound + 1];
for (int m = 2; m <= upperBoundSquareRoot; ... | 5 |
public boolean inDuelArena() {
if((absX > 3322 && absX < 3394 && absY > 3195 && absY < 3291) ||
(absX > 3311 && absX < 3323 && absY > 3223 && absY < 3248)) {
return true;
}
return false;
} | 8 |
@Override
//Disparado quando a tag de inicio eh encontrada
public void startElement(String uri, String localName,
String qName, Attributes attributes)
throws SAXException {
String tipo = getTipo();
if(tipo.equals("getCPU")){
switch(qName.toLowerCase()){ //tag atual. Ex.: <host.... | 2 |
public void func() {
System.out.println(this + ".func() : " + data);
} | 0 |
public static Item[] getSortedList() {
Item[] inventoryList = Survivalist.getCurrentGame().getInventory().clone();
Item tempItem;
for(int i = 0; i < inventoryList.length - 1; i++) {
for (int j = i + 1; j < inventoryList.length; j++) {
if(inventoryList[i].getD... | 3 |
public void mouseExited(MouseEvent e) {
} | 0 |
private static ArrayList<File> files(File dir)
{
final ArrayList<File> files = new ArrayList<File>();
if (!dir.isDirectory()) throw new IllegalArgumentException("dir Isn't a Directory! " + dir);
for (int i = 0; i < dir.listFiles().length; i++)
{
if (dir.listFiles()[i].isDirectory())
{
files.addAll(... | 3 |
public static void turn (char[][] game, int player){
int x, y;
//read in x & y coordinates
boolean valid_coord = false;
while (!valid_coord){
Scanner in = new Scanner(System.in);
System.out.println("Player " + player);
System.out.println("Please enter your x coordinate: ");
x = in.nextInt();
Syst... | 9 |
protected void validateField() throws Exception {
// do some type checking here
if (m_fieldDefs != null) {
Attribute a = getFieldDef(m_fieldName);
if (a == null) {
throw new Exception("[FieldRef] Can't find field " + m_fieldName
+ " in the supplied field definitions");
}
... | 7 |
public void addFormVotingUser(int userId, int formId) throws ErrorAddingUserException {
try {
String q = "insert into ValidVoter values(?, ?);";
PreparedStatement st = conn.prepareStatement(q);
st.setInt(1, userId);
st.setInt(2, formId);
st.executeUpda... | 2 |
@EventHandler
public void onChat(PlayerChatEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
ChatMode chatMode = ruChat.modes.get(player);
boolean isGlobal = event.getMessage().startsWith("!") && event.getMessage().length() >... | 9 |
@Override
public boolean register(Game g, Rack r) {
super.register(g, r);
no_progress = g.rack_size*2;
return random.register(g, r) && learner.register(g, r);
} | 1 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
final XYDataset dataset = studyDatasetBaseLyon();
final JFreeChart chart = createSimpleChart(dataset);
final ChartPanel chartPanel = new ChartPanel(chart);
... | 2 |
@Override
public boolean createTable(String query) {
Statement statement = null;
try {
if (query.equals("") || query == null) {
this.writeError("SQL Create Table query empty.", true);
return false;
}
statement = connection.createStatement();
statement.execute(query);
return true;
} catch ... | 3 |
public static boolean setNewLeader(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you be... | 7 |
public CharSequence getNameSignature() {
String stereotypes = Stereotypes.toSignature(this.stereotypes);
if(stereotypes!=null && !stereotypes.isEmpty())
return stereotypes + " " + className;
return className;
} | 2 |
public static Territory[] getTerritories(String mapName) throws IOException{
File file = new File("WarbornData/maps/" + mapName + ".txt");
LineNumberReader lnr = new LineNumberReader(new FileReader(file));
lnr.skip(file.length()-1);
int lines = lnr.getLineNumber()+1;
BufferedReader in = new BufferedReader(... | 7 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(double1);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result
+ ((doubleObject == null) ? 0 : doubleObject.hashCode());
result = prime * result + Float.floatTo... | 5 |
private DataTelegram getDataTelegram(final long maximumWaitingTime, byte telegramType) {
long waitingTime = 0, startTime = System.currentTimeMillis();
long sleepTime = 10;
while(waitingTime < maximumWaitingTime) {
try {
synchronized(_syncSystemTelegramList) {
if(_disconnecting) throw new RuntimeExcept... | 7 |
static private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
... | 9 |
public ArrayList<Ticket> createTicketArrayListByQueue(int queueType) {
ArrayList<Ticket> result = new ArrayList<Ticket>();
ResultSet rs = null;
PreparedStatement statement = null;
try {
String sqlString;
switch (queueType) {
case 0:
sqlString = "select * from Tickets where Pending=true";
... | 9 |
private String replacePi(String calculation) {
return calculation.replaceAll("pi", Double.toString(Math.PI));
} | 0 |
public String getId() {
return id;
} | 0 |
@Test
public void validationDoubleWithDoublePositiveTest() {
view.getTimeStepTextField().setText("11.6");
view.getTimeStepTextField().getInputVerifier().verify(view.getTimeStepTextField());
assertTrue(view.getDrawButton().isEnabled());
} | 0 |
@Override
public boolean perform(final Context context) {
// Example: /<command> format[ get][ <Player>]
int position = 2;
if (context.arguments.size() >= 2 && !context.arguments.get(1).equalsIgnoreCase(this.name)) position = 1;
OfflinePlayer target = Parser.parsePlayer(context, posi... | 7 |
public void visitCheckExpr(final CheckExpr expr) {
if (expr instanceof ZeroCheckExpr) {
visitZeroCheckExpr((ZeroCheckExpr) expr);
} else if (expr instanceof RCExpr) {
visitRCExpr((RCExpr) expr);
} else if (expr instanceof UCExpr) {
visitUCExpr((UCExpr) expr);
}
} | 3 |
public void handleKey(int action){
if(action<0 || current == 0){
if(action==current)
current=0;
return;
}
switch(current){
case InteractivePanel.LEFT:
properties.setLeftCtrl(action);
leftCtrl.setText(KeyEvent.getKeyText(action));
break;
case InteractivePanel.RIGHT:
properties.setRightCtr... | 8 |
public static void registerSlot(Slot slot, String targetSignal, Class<?>[] params) throws IllegalArgumentException, InvalidReturnTypeException
{
SignalStructure struct = linker.get(targetSignal);
if (params == null)
{
if (struct.getInvokerParameters() != null)
{
throw new IllegalArgumentException("Erro... | 9 |
public void processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
{
if((inOff + len) > in.length)
{
throw new RuntimeException("output buffer terlalu sedikit");
}
if((outOff + len) > out.length)
{
throw new... | 3 |
public void input(char input){
if(!running){
running=true;
player.charInput(input);
for(Enemy e: enimies){
//e.takeTurn();
}
running=false;
}
} | 2 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((password == null) ? 0 : password.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result
+... | 4 |
public JdbcQueryTaskParameters(String sql, int fetchSize, boolean returnKeys, PreparedStatementCallback<?> action,
Object... args) {
int hashCode = 0;
this.sql = sql;
hashCode += sql.hashCode();
this.fetchSize = fetchSize;
hashCode += fetchSize;
this.returnKeys = returnKeys;
hashCode += (retu... | 5 |
public boolean Hand1BeatsHand2(String hand1, String hand2) {
Hand firstHand = new Hand(hand1);
Hand secondHand = new Hand(hand2);
PokerHandValue firstHandRank = GetHandRank(firstHand);
PokerHandValue secondHandRank = GetHandRank(secondHand);
while (firstHandRank.compareTo(secon... | 7 |
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 ArrayList<HashMap<String, String>> getOxima(int id){
/*
* epistefei ta stoixia enos sugkekrimenou oximatos
*/
ArrayList<HashMap<String, String>> oxima=new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
try {
pS = conn.prepareStatement("SELECT *... | 3 |
public static InputStream loadResourceAsStream(String resourcePath) {
if(resourcePath.startsWith("/")){
return ResourceLoader.class.getResourceAsStream(resourcePath);
}else{
System.err.println("A resource path must(!) begin with a \"/\"");
return null;
}
} | 1 |
@Override
public Card chooseCard(Player player, Card[] cards, GameState state) {
//If there's only one choice, we have no choice but to do it
if(cards.length == 1)
{
return cards[0];
}
int alpha = Integer.MIN_VALUE;
int beta = Integer.MAX_VALUE;
Card choice = null;
ArrayList<Color> playerLi... | 4 |
public int getS1() {
return this.state1;
} | 0 |
final void method1228(int i, int i_63_, int i_64_, int[] is, boolean bool,
int[] is_65_) {
try {
if ((anInt2103 ^ 0xffffffff) != (i_64_ ^ 0xffffffff))
anInt2103 = i_64_;
anIntArray2092 = is;
if (i_63_ <= 54)
anIntArray2092 = null;
((Class154) this).anIntArray2095 = is_65_;
anInt2090++... | 5 |
public Expr array_length(Context ctx, HashMap<String, Expr> symbolTable) throws Z3Exception{
Expr ret = null;
if(this.a_inputs.get(0).leaf!=null && this.a_inputs.get(0).leaf.type.equals("string") && symbolTable.containsKey(((a_string)this.a_inputs.get(0).leaf).s)){
ret = ctx.MkConst((((a_string)this.a_inputs.get... | 8 |
public int GetBusNumber()
{
return busNumber;
} | 0 |
private void recv(SyncPDU m) {
cancelTimerTask();
try {
byte type = m.getType();
boolean sv = false;
switch (type) {
case SyncPDU.REQALL:
respondSendAllItems(m);
break;
case SyncPDU.REQ:
... | 5 |
public static boolean checkSudoku(int[][] matrix) {
ArrayList<HashSet<Integer>> rowsSets = new ArrayList<HashSet<Integer>>(9);
ArrayList<HashSet<Integer>> columnsSets = new ArrayList<HashSet<Integer>>(9);
ArrayList<HashSet<Integer>> subSets = new ArrayList<HashSet<Integer>>(9);
for(int i = 0; i < 9; i++) ... | 7 |
private static void dfs(int n, ArrayList<ArrayList<Integer>> g, ArrayList<Integer> results, boolean[] visited){
visited[n]=true;
for(Integer neighbor:g.get(n)){
if(!visited[neighbor]){
dfs(neighbor, g, results, visited);
}
}
results.add(n);
} | 2 |
private void putInCache(String prefix, String uri) {
// Not already in cache
if (!uri2Prefix.containsKey(uri)) {
// Find an available default namespace
if (DEFAULT_NS.equals(prefix)) {
int index = 0;
while(prefix2Uri.containsKey(DEFAULT_NS + index)){
index++;
... | 3 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 6 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
//------------------------------------------------------------------------------Painting the correct character
if (characterChosen == 1) {
g.drawImage(hero.image, heroCurrentX, heroCurrentY, 50, 50, null)... | 7 |
public static Check getInstance(int checkType)
throws UnsupportedOptionsException {
switch (checkType) {
case XZ.CHECK_NONE:
return new None();
case XZ.CHECK_CRC32:
return new CRC32();
case XZ.CHECK_CRC64:
return n... | 5 |
private void loadSettings() {
if (settings.containsKey(Settings.THEME)) {
changeTheme((String)settings.get(Settings.THEME));
} else {
changeTheme(Utils.GUITHEME.Snow.name());
}
if (settings.containsKey(Settings.SCREEN_LOC_X)) {
int x = ((Number)settings.get(Settings.SCREEN_LOC_X)).intValue();
int... | 3 |
public static EnvironmentReasonEnumeration fromString(String v) {
if (v != null) {
for (EnvironmentReasonEnumeration c : EnvironmentReasonEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
public void keyReleased(KeyEvent Par1)
{
int Key = Par1.getKeyCode();
if(currentState == State.Game)
{
if(Key == KeyEvent.VK_W)
{
Character.setVelY(0);
Character.canMoveUp = true;
}
else if(Key == KeyEvent.VK_S)
{
Character.setVelY(0);
Character.canMoveDown = true;
}
... | 9 |
private void popAndDownload()
{
Downloadable downloadable;
while ((downloadable = (Downloadable)this.remainingFiles.poll()) != null) {
if (downloadable.getNumAttempts() > 5) {
if (!this.ignoreFailures) this.failures.add(downloadable);
//Launcher.getInstance().println("Gave up trying to d... | 5 |
public Timestamp getRegtime() {
return this.regtime;
} | 0 |
public boolean isDefault(aos.apib.Base o) {
TrackerInfo__Tuple v = (TrackerInfo__Tuple)o;
if (v.id != __def.id) return false;
if (v.warningCount != __def.warningCount) return false;
if (v.upload != __def.upload) return false;
if (v.download != __def.download) return false;
if (v.isOnline != __def.isOnline) ... | 9 |
private String affectedFacialTarget(int affected)
{
switch(affected)
{
case 0:
return "outer-left character";
case 1:
return "inner-left character";
case 2:
return "inner-right character";
case 3:
... | 7 |
public void Login() throws IOException {
String urlString = "";
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// client.setCookies(connection, cookieJar);
connection.setDoOutput(true);
connection.setRequestMethod("POST")... | 1 |
public int ladderLength(String start, String end, Set<String> dict) {
Queue<String> queue = new LinkedList<String>();
Set<String> visited = new HashSet<String>();
int level = 1;
int lastNum = 1;
int curNum = 0;
queue.offer(start);
visited.add(start);
while(!queue.isEmpty()){
String cur = que... | 7 |
private void complExpAritmetica() {//ok
if (tipoDoToken[1].equals(" +")) {
if (!acabouListaTokens()) {
nextToken();
this.termoAritmetico();
if (!acabouListaTokens()) {
nextToken();
this.complExpAritmetica();
... | 6 |
public TTTBoard() {
grid = new Grid();
ComputerPlayerMinMax computer = new ComputerPlayerMinMax(grid);
computer.setType(CellType.CROSS);
int firstPlayer = -1;
System.out.println("Your symbol is O and computer's symbol is X.");
System.out.println("Enter 0 to play first; 1 to let computer play first.");
... | 9 |
@Override
public void clearAttributes() {
if (attributes != null) {
this.attributes.clear();
this.isReadOnly.clear();
}
} | 1 |
public static void start(Component component, Cursor cursor) {
JRootPane rootPane = SwingUtilities.getRootPane(component);
if (rootPane != null) {
Component glassPane = rootPane.getGlassPane();
MouseCapture capture = new MouseCapture(glassPane, component);
glassPane.addMouseListener(capture);
glassPane.... | 2 |
public AST rStatement() throws SyntaxError {
AST t;
if (isNextTok(Tokens.If)) {
scan();
t = new IfTree();
t.addKid(rExpr());
expect(Tokens.Then);
t.addKid(rBlock());
expect(Tokens.Else);
t.addKid(rBlock());
r... | 5 |
@Test
public void test_getSizeY(){
assertNotNull(pawn);
assertEquals(posY, pawn.getY());
} | 0 |
public static boolean isVandalism(int s) {
if(s==62977)
return true;
return false;
} | 1 |
private void Ok()
{
if(list == null)
{
setList();
}
if(loginTextField.getText().length() == 0)
{
JOptionPane.showMessageDialog(f, "Enter login");
return;
}
if(passTextField.getText().length() == 0)
{
JOptionPane.showMessageDialog(f, "Enter password");
return;
}
try {
ConnectMet... | 9 |
private boolean isPic(String s) {
if(s.startsWith("http") && (s.contains(".jpg")||s.contains(".png")||s.contains(".bmp")||s.contains(".gif")||s.contains("jpeg"))){
return true;
}
else
return false;
} | 6 |
public static String escapeChars(final byte... bytes)
{
final StringBuilder buf = new StringBuilder();
for (byte b : bytes)
if (b >= 32 && b < 127)
buf.append(Character.toChars(b));
else
buf.append('.');
return buf.toString();
} | 3 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0)break;
int[] a = new int[n];
for(int i=0;i<n;i++)a[i]=sc.nextInt();
int s = a[0];
int t = a[0];
Queue<String> l = new LinkedList<String>();
for(int i=1;i<n;i++){
if(t+... | 9 |
public static void createTiles() {
try {
Tilelist = new ArrayList<Tile>();
SpriteSheet tiles = new SpriteSheet(PATH_TILE, TILEWIDTH, TILEHEIGHT);
tiles.setFilter(SpriteSheet.FILTER_NEAREST);
SpriteSheet walls = new SpriteSheet(PATH_WALL, WALLWIDTH, WALLHEIGHT);
walls.setFilter(SpriteSheet.FILTER_NEARES... | 7 |
public static TreeNode getLastCommonParent(TreeNode root, TreeNode n1, TreeNode n2) {
if (root == null || n1 == null || n2 == null) {
return null;
}
ArrayList<TreeNode> p1 = new ArrayList<TreeNode>();
boolean res1 = getNodePath(root, n1, p1);
ArrayList<TreeNode> p2 = new ArrayList<TreeNode>();
boolean r... | 8 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (true) {
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
if (x1 + x2 + y1 + y2 == 0) return;
int dx = x1 - x2;
i... | 7 |
public Set<String> getURLs(String url) throws IOException {
Set<String> urls = new HashSet<>();
String content = getURLContent(url);
Matcher m = Pattern.compile(urlPattern).matcher(content);
while (m.find()) {
urls.add(m.group());
}
return urls;
} | 1 |
public void flipHorizontal() {
byte image[] = new byte[width * height];
int off = 0;
for (int offY = 0; offY < height; offY++) {
for (int offX = width - 1; offX >= 0; offX--) {
image[off++] = pixels[offX + offY * width];
}
}
pixels = image;
offsetX = trimWidth - width - offsetX;
} | 2 |
public ArrayList<ArrayList<Integer>> permute(int[] num) {
LinkedList<int[]> mappers = search(num.length);
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
for (int[] mapper : mappers) {
ArrayList<Integer> tmp = new ArrayList<Integer>();
for (int... | 2 |
public static VoteCast closePolls(){
open = false;
Broadcast.vote("Voting for next map is now closed.");
VoteCast win;
if(A >= B && A >= R) win = VoteCast.A;
else if(B > A && B >= R) win = VoteCast.B;
else win = VoteCast.R;
HotbarManager.clearAll();
return win;
} | 4 |
@Test
public void clone_test() {
try{
double []mat1= {1.0,2.0,3.0,1.0};
double result[] = Vector.clone(mat1);
double exp[]= {1.0,2.0,3.0,1.0};
Assert.assertArrayEquals(exp, result, 0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented");
}
} | 1 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
if (this.troveKey == null){
Properties props = new Properties();
try{
// properties file should be put here (not included in repo)
props.loa... | 2 |
public List<List<Object>> calculateMedianString() {
List<List<Object>> bestKMer = new ArrayList<List<Object>>();
List<String> allKMers = calculateAllKMers();
int smallestHammingDistance = allKMers.size();
for (String pattern : allKMers) {
List<Object> helpList = new ... | 3 |
public boolean checkSetState(UnitState s) {
switch (s) {
case ACTIVE:
case SENTRY:
return true;
case IN_COLONY:
return !isNaval();
case FORTIFIED:
return getState() == UnitState.FORTIFYING;
case IMPROVING:
return location in... | 9 |
public boolean pickAndExecuteAnAction() {
if(!payments.isEmpty()){
for(Payment p: payments){
makeTransaction(p);
return true;
}
}
if(!marketpayments.isEmpty()){
synchronized(marketpayments){
for(MarketPayment m: marketpayments){
PayMarket(m);
return true;
}
}
}
... | 8 |
@Override
public String makeMove(CardGame game, CardPanel panel) {
Hand hand = game.getHand();
List<List<Card>> board = game.getBoard();
Card fromDeck = game.getDeck().pop();
//Do this first in case we get the same index twice in a row!
if (hand != null && hand.getIndex() != ... | 2 |
public void testGet_DateTimeFieldType() {
DateMidnight test = new DateMidnight();
assertEquals(1, test.get(DateTimeFieldType.era()));
assertEquals(20, test.get(DateTimeFieldType.centuryOfEra()));
assertEquals(2, test.get(DateTimeFieldType.yearOfCentury()));
assertEquals(2002, tes... | 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.