text stringlengths 14 410k | label int32 0 9 |
|---|---|
public final static Deserializer init(final SongData sdc, final MasterThread master) {
final Path idx = getIdx(sdc.getRoot());
final IOHandler io = sdc.getIOHandler();
final Map<String, AbstractInputStream> zipEntriesMap;
if (!idx.exists())
zipEntriesMap = null;
else
zipEntriesMap = io.openInZip(idx);
... | 9 |
public void exportClass() {
//Check if there is any diagram objects to export
if (vod.size() == 0) {
//If not, display error message box
JOptionPane.showMessageDialog(null, "No information available to export", "UMLator | Export Error", JOptionPane.ERROR_MESSAGE);
} else { //Otherwise..
//Display sav... | 7 |
public static Map<Integer, ZState> createStates(List<Connection> connections){
Map<Integer, ZState> states = new HashMap<>();
for(Connection connection: connections){
if(!states.containsKey(connection.from)){
states.put(connection.from, new ZState(connection.from, co... | 3 |
private void makeToggleButtons() {
displaySpeedButton.setGraphic(
new ImageView(ImageGetter.getTeXImage("Instant \\leftarrow Step")));
modeButton.setGraphic(
new ImageView(ImageGetter.getTeXImage("Compact \\leftarrow Full")));
displayResponseSpeedButton.setGraphic(
new ImageView(ImageGetter.getTeXIma... | 2 |
public boolean isCollision()
{
for(int i=0;i<4;i++)
{
if(sqrBlock[i].getX()<=-1||sqrBlock[i].getX()>=10)//出界
return true;
else //触及其他积累的块
{
for (int k = 0; k < 10; k++) {
for (int j = 0; j < 20; j++) {
... | 8 |
private void updateStateToolRight(List<Keyword> keywords, List<String> terms, List<String> approval) {
RecipeLearningState nextState;
if (approval.isEmpty()) {
DialogManager.giveDialogManager().setInErrorState(true);
}
else if (approval.get(0).equals("yes")) {
nextState = new RecipeLearningState();
nextState.... | 3 |
public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
long[] dg1 = new long[2*n];
long[] dg2 = new long[2*n];
int[][] a = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; ... | 7 |
public static ArrayList <ToolData> loadData() {
File load = new File("resources/files/ToolData/");
Gson loader = new Gson();
ArrayList <ToolData> res = new ArrayList <ToolData>();
for (File f : load.listFiles()) {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotF... | 6 |
private void generateTree(Node root) {
while (itemsCount > 0) {
int childCount = Math.abs(new Random().nextInt()) % 3;
itemsCount--;
switch (childCount) {
case 0: {
root.right = null;
root.left = null;
... | 5 |
public boolean findWord (String word) {
if (word == null || word.length() == 0) {
return false;
}
TrieTree curNode = this;
int pos;
char c;
for (int i = 0; i < word.length(); i++) {
c = word.charAt(i);
pos = c - 'a';
if (curNode.child[pos] == null) {
return false;
} else {
curNode = c... | 4 |
public boolean add(Behaviour plan) {
if (plan == null) return false ;
final boolean finished = plan.finished() ;
final float priority = plan.priorityFor(actor) ;
final Behaviour nextStep = plan.nextStepFor(actor) ;
if (finished || priority <= 0 || nextStep == null) {
if (verboseReject && ... | 7 |
@Override
public int compare(GraphNode x, GraphNode y)
{
if (x.cost < y.cost) {
return -1;
} else if (x.cost > y.cost) {
return 1;
} else {
return 0;
}
} | 2 |
static double[][] floydWarshall2(double[][] mAdy){
int N; double[][] res = new double[N=mAdy.length][N];
for(int i=0;i<N;i++)for(int j=0;j<N;j++)res[i][j]=mAdy[i][j];
for(int k=0;k<N;k++)
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
if(res[i][k]<Double.MAX_VALUE&&res[k][j]<Double.MAX_VALUE)
res[i][j]=Math.mi... | 7 |
@Override
public void run() {
// adjust to perfectFailure or EventuallyPerfectFailure
int timeout = Delta + perfectFailure();
while (true) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
// **Test
printSuspected();
// go through... | 7 |
private WSResponse addCalData(WSResponse response, CalendarData calData) {
if(calData!=null){
if(calData.getEvents()!=null && calData.getEvents().size()>0){
for (CalEvent cal : calData.getEvents()) {
Events event=new Events();
event.setMessage(cal.getMessage());
event.setSource("googlecalendar")... | 7 |
public void clickButtonAtJXList(org.jdesktop.swingx.JXList list,
Point pointer) {
int index = list.locationToIndex(pointer);
if (index >= 0) {
JPanel o = (JPanel) list.getModel().getElementAt(index);
pointer.y -= (o.getHeight() * index);
if (o.contains(pointer)) {
Object oO = ((Component) o).getComp... | 7 |
public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][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 |
protected boolean wantBraces() {
StructuredBlock block = subBlock;
if (block == null)
return false;
for (;;) {
if (block.declare != null && !block.declare.isEmpty()) {
/* A declaration; we need braces. */
return true;
}
if (!(block instanceof SequentialBlock)) {
/*
* This was the las... | 9 |
private void movingToResPile(GameSpot fromSpot, GameSpot toSpot,
int numberOfCardsToMove) {
Deck fromDeck = getDeck(fromSpot);
Card fromCard = fromDeck.showTopCard();
switch(getDeck(fromSpot).getTopCard().getSuit()){
case HEART: toSpot = GameSpot.RESOLUTION_HEARTS;
break;
case DIAMOND: toSpot = GameSpot... | 7 |
public Set<Coordinate> getLegalMoves(Coordinate startingCoord, Board board) {
Set<Coordinate> legalMoves = new LinkedHashSet<Coordinate>();
Color color = board.getPiece(startingCoord).getColor();
int[] deltaX = {1, 2, 2, 1, -1, -2, -2, -1};
int[] deltaY = {2, 1, -1, -2, -2, -1, 1, 2};
for (int i = 0; i < d... | 4 |
public String getScore(){
rover = head;
String blank = "";
while(rover!=null){
if(rover.status == 1){
blank = blank + rover.name + " - " + rover.score + "\n";
}
rover = rover.next;
}
return blank;
} | 2 |
public int maxPoints(){
//Create a dummy rack and use scorePoints to get max score
Rack dummy = new Rack(rack_size, this);
int[] best = new int[rack_size];
for (int i=0; i<rack_size; i++)
best[i] = i+1;
dummy.deal(best);
return dummy.scorePoints(bonus_mode);
} | 1 |
private void doUpdateFS(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String fsId = StringUtil.toString(request.getParameter("fsId"));
if(!StringUtil.isEmpty(fsId)) {
ObjectMapper mapper = new ObjectMapper();
Map result = new Ha... | 3 |
public void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = scaleX(x... | 4 |
public final int reverseScan(int from, byte[] sign, int limit) {
pos = from - sign.length;
if (pos < 0) {
pos = 0;
return -1;
}
int scanto = pos - limit;
if (scanto < 0) scanto = 0;
boolean found;
while (pos >= scanto) {
fou... | 6 |
public void noteStk(int s,int a) {
if (Debug.enabled)
Debug.check(cW<=mW);
if ((s>=0) && (s!=9)) {
cW--;
if ((s & (~2)) == 5) cW--; // Note additional word for J and D
if (Debug.enabled)
Debug.check(cW>=0);
};
if ((a>=0) && (a!=9)) {
cW++;
if ((a & (~... | 9 |
public Boolean setGridArray(int x, int y, Game.PlayerTurn pt) {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setGridArray() BEGIN");
}
m_gridArray[x][y] = pt;
if (test || m_test) {
System.out.println("FileManager :: setGridArray() END");
}
... | 4 |
public double logScore(int nType, int nCardinality) {
double fScore = 0.0;
switch (nType) {
case (Scoreable.BAYES): {
for (int iSymbol = 0; iSymbol < m_nSymbols; iSymbol++) {
fScore += Statistics.lnGamma(m_Counts[iSymbol]);
}
fScore -= Statistics.lnGamma(m_SumOfCounts);
... | 9 |
public void displayMatrix() {
System.out.println("Displaying matrix which has "
+ this.getMatrixSize() + " elements...");
for (int i = 0; i < size; i++) {
System.out.print(" +");
for (int k = 0; k < size; k++) {
System.out.print("-----+");
}
System.out.println();
System.out.print... | 4 |
public static void main(String[] args) {
SynchronizationTest1 test = new SynchronizationTest1();
long t1, t2, delta_t;
long sumTestX = 0, sumTestY = 0, sumTestZ = 0, sumTestV = 0;
// provest zadany pocet testu
for (int i = 0; i < 10; i++) {
// provest test a zmerit c... | 9 |
public double loadImage(String file) {
global = GlobalMode.EditMode;
//setEdit();
lb.drawMode();
image = null;
this.scale = 1;
try {
image = ImageIO.read(new File(file));
} catch (IOException e) {
System.out.println("Error Opening File: " +... | 6 |
static final public TreeLocation Location() throws ParseException {
/*@bgen(jjtree) Location */
SimpleNode jjtn000 = new SimpleNode(JJTLOCATION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token rel;
TsurgeonPattern child;
try {
rel = jj_consume_token(LOCATION_RELATION);
child = Node... | 9 |
public TileMap loadNextMap() {
TileMap map = null;
while (map == null) {
currentMap ++ ;
try {
map = loadMap(
"maps/map" + currentMap + ".txt");
}
catch (IOException ex) {
if (currentMap == 1) {
... | 3 |
public static void main(String[] args) {
ArrayQueue arrayQueue = new ArrayQueue(10);
arrayQueue.add(0);
arrayQueue.add(1);
arrayQueue.add(2);
arrayQueue.add(3);
arrayQueue.add(4);
arrayQueue.add(5);
arrayQueue.add(6);
arrayQueue.add(7);
arrayQueue.add(8);
arrayQueue.add(9);
... | 2 |
public void visitJumpInsn(final int opcode, final Label lbl) {
super.visitJumpInsn(opcode, lbl);
LabelNode ln = ((JumpInsnNode) instructions.getLast()).label;
if (opcode == JSR && !subroutineHeads.containsKey(ln)) {
subroutineHeads.put(ln, new Subroutine());
}
} | 2 |
@Override
public void perform(CommandSender sender, String[] args) {
List<String> GymTypes = instance.getConfig().getStringList("GymTypes");
if (args.length == 3)
{
if (args[0].equalsIgnoreCase("Del"))
{
for (String i : GymTypes)
{
// Check for the gym
if (args[1].equalsIgnoreCase(i))
... | 6 |
static byte FurnaceFix(byte data, String kierunek)
{
if (kierunek.equals("right"))
{
if (data == 2) {
return 5;
}
if (data == 4) {
return 2;
}
if (data == 5) {
return 3;
}
if (data == 3) {
return 4;
}
}
els... | 9 |
public static void main(String[] args) {
Integer min = 10000;
Integer max = 100000;
int socketNum = 5;
int temp = 0;
long startTime = 0;
try {
System.out.println("Server running...");
ServerSocket ss = new ServerSocket(9999);
for (int i = 0; i < socketNum; i++) {
Socket sm = new Socket("localh... | 5 |
public MainConfigHandler(final File working_directory, final List<Route> routes)
{
this.working_directory = working_directory;
this.routes = routes;
} | 0 |
@Override public boolean getControls(String control){
if(control == "Age"){ return true;}
if(control == "Fade"){return true;}
if(control == "Mat"){ return true;}
if(control == "Dir"){ return true;}
if(control == "InMode"){return true;}
if(control == "Xfact"){return true;}
return false;} | 6 |
@Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.isEmpty())
throw new Exception("IR_F: pila vacia");
Valor op = st.pop();
if (op instanceof Booleano) {
if (! (boolean) op.getValor())
cp.set((int) pd.getValor());
else
cp.incr();
}
else
... | 3 |
public void printListRev(){
System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness);
if (lastPatient != null){
lastPatient.printListRev();
}
} | 1 |
public static void saveTopWords(List<Datum> train, String fileName, int topK) throws FileNotFoundException, IOException{
Map<Integer, Integer> wordCount = new HashMap<Integer, Integer>();
for(Datum d : train){
int index = getIndex(d.word);
if(wordCount.containsKey(index)){
wordCount.put(index, wordCount.... | 5 |
public String getX509IssuerName() {
return x509IssuerName;
} | 0 |
@Override
public void sync(String name) throws IOException {
ensureOpen();
File fullFile = new File(directory, name);
boolean success = false;
int retryCount = 0;
IOException exc = null;
while(!success && retryCount < 5) {
retryCount++;
RandomAccessFile file = null;
try {
... | 7 |
private List<OfflinePlayer> getPlayers(Server server) {
Player[] online = server.getOnlinePlayers();
OfflinePlayer[] offline = server.getOfflinePlayers();
List<OfflinePlayer> players = new ArrayList<OfflinePlayer>();
for (Player p : online) {
players.add(p);
}
for (OfflinePlayer p : offline) {
... | 4 |
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 void onMoveMade(Move move) {
for (GameEventListener l : this.gameEventListeners) {
l.onMoveMade(move);
}
} | 1 |
public void refreshImage() {
removeAll();
for (int i = 0; i < 5; i++) {
if (i >= hand.size()) {
add(new JLabel(new ImageIcon(getClass().getResource(
"resources/53.png"))));
} else {
add(hand.get(i));
}
}
revalidate();
repaint();
} | 2 |
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
MediaLibAccessor srcMA =
new MediaLibAccessor(sources[0], destRect, format... | 9 |
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 |
@SuppressWarnings("unchecked")
private <F> boolean queryExternal(JoinQuery query, JoinQueryResultHandler<E, F> handler, SpatialIndex<E>.Node node1, SpatialIndex<F>.Node node2) {
for (int i = 0; i < node1.numEntries; i++) {
int k = node1 == node2 ? i + 1 : 0;
for (int j = k; j < node2.numEntries; j++) {
if... | 9 |
protected @Override Module retrieveModule(final String locator, final long revision) throws StorageException {
assert (locator != null): "Supplied locator is null";
assert (!"".equals(locator)): "Proof module supplied";
assert (revision >= 0): "Invalid version number supplied";
try {
final String urlEncodedL... | 7 |
public void keyPressed(KeyEvent key)
{
switch (key.getKeyCode()) {
case KeyEvent.VK_LEFT:
nextDirection = 3;
break;
case KeyEvent.VK_RIGHT:
nextDirection = 1;
break;
case Key... | 5 |
public static byte[] getXmitBytes(ROJoystickHandler joystickHandler, boolean heartbeat) {
byte messageType;
if (heartbeat)
messageType = ROMessageTypes.HEARTBEAT_PACKET;
else
messageType = ROMessageTypes.CONTROL_PACKET;
byte[] header = { messageType };
if (!heartbeat) {
... | 2 |
final void method3446(ByteBuffer class348_sub49, Class197 class197) {
int i = class348_sub49.getUByte();
((Class349) this).anIntArray4299[0] = i >> 4;
((Class349) this).anIntArray4299[1] = i & 0xf;
if (i != 0) {
anIntArray4304[0] = class348_sub49.getShort();
anIntArray4304[1] = class348_sub49.getShort();
... | 8 |
public Renter getRenterByID(String token, String ID) throws AccessException{
if(token != "abcd1234") throw new AccessException("Access denied");
try {
boolean notFound = true;
Iterator<Renter> I = this.renters.iterator();
while(I.hasNext()){
Renter temp = (Renter)I.next();
if(ID.equals(temp.getID()))
... | 5 |
public void update() {
// update position
getNextPosition();
checkTileMapCollision();
setPosition(xtemp, ytemp);
// check flinching
if (flinching) {
long elapsed = (System.nanoTime() - flinchTimer) / 100000;
if (elapsed > 400) {
flinching = false;
}
}
// if we hit a wall, go the other way!... | 6 |
public static boolean fieldChanged(String existing, String incoming) {
if (existing != null && existing.isEmpty())
existing = null;
if (incoming != null && incoming.isEmpty())
incoming = null;
return (existing == null && incoming != null || existing != null
&& !existing.equals(incoming));
} | 7 |
public String getYKey(){
return getAxisKey(Axis.Y);
} | 0 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin (PlayerJoinEvent event){
Player player = event.getPlayer();
World world = Bukkit.getServer().getWorld(plugin.lobbyWorld);
Location location = player.getLocation();
if (plugin.tpToSpawnOnLogin){
location = this.getNewLocation(wor... | 6 |
public synchronized Queue<WebPage> getUnsearchQueue() {
return unsearchQueue;
} | 0 |
private void invisibility (Player player, int level, ItemStack i) {
int duration = 0;
int cooldown = 1000;
if (level == 1) {
duration = 200;
} else if (level == 2) {
duration = 300;
} else if (level == 3) {
duration = 400;
}
if (invisDurabilityTimer.cooldownMap.get(player) == null) {
... | 5 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the... | 9 |
private void uploadBedFile(){
File peptideFile = new File(bedFile);
//
int id = 0;
int chromosomeName = -1;
int startLocation = -1;
int stopLocation = -1;
String sequence = "";
String score = "";
int strand = -1;
String color = "";
String blockCount = "";
String blockSize = "";
String blockSta... | 7 |
private int hasPlayers(JTileResource tile) {
int counter = 0; // Le compteur de villes ennemies.
int townNumber = 0; // Le numero de la ville etant parcourue.
int ennemieNumber = -1; // Le numero du dernier joueur ennemi rencontre (initialise a -1).
boolean different_ennemies = false; // Un booleen indiquant si... | 8 |
private Collection<Enemy> createEnemies(Integer i, Byte b) {
Collection<Enemy> newEnemies = new LinkedList<Enemy>();
System.out.println("EnemyID: " + i);
switch(i){
case Definitions.EnemyOneID:
for (int x = 0; x< b; x++){
newEnemies.add(new EnemyOne());
}
break;
case Definitions.EnemyTwoID:... | 4 |
private static void withoutGenerics() {
Container c = new Container();
String s = new String("it is a string");
c.setInternal(s);
//...
String internal2 = (String) c.getInternal();
System.out.println(internal2);
c.setInternal(new Integer(5));
// ...
// String internal3 = (String) c.getInternal... | 1 |
public boolean pad(int width) throws IOException {
boolean result = true;
int gap = (int) this.nrBits % width;
if (gap < 0) {
gap += width;
}
if (gap != 0) {
int padding = width - gap;
while (padding > 0) {
if (bit()) {
... | 4 |
private void initPrefetch() {
if (theWorker == null) {
state = UIState.READCACHEPAGES;
lblStatus.setText("Prefetching");
theWorker = new MyWorker(rootPage, JobType.READCACHEPAGES, false);
theWorker.execute();
disableButtons();
}
} | 1 |
public void exit(){
threadExit.start();
while (!threadExit.getState().equals(Thread.State.TERMINATED)) {
if (gui.isAborted()) {
setTransportationState(TransportationState.ABORTED);
break;
} else {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.error(Th... | 4 |
public int addToArray(treeNode node, int[] array, int index) {
int newIndex = index;
if (node == null)
return index;
if (node.leftLeaf != null) {
newIndex = addToArray(node.leftLeaf, array, index);
}
array[newIndex] = node.value;
newIndex++;
if (node.rightLeaf != null) {
newIndex = addToArray(n... | 3 |
@Basic
@Column(name = "FUN_APELLIDOS")
public String getFunApellidos() {
return funApellidos;
} | 0 |
@Override
public void tick() {
if(InputHandler.isDown("up")){
this.translate(0, -3);
}else if(InputHandler.isDown("down")){
this.translate(0, 3);
}
if(InputHandler.isDown("left")){
this.translate(-3, 0);
}else if(InputHandler.isDow... | 4 |
public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
Enumeration keys = keys();
writer.write('{');
while (keys.hasMoreElements()) {
if (b) {
writer.write(',');
}
Ob... | 5 |
public static boolean parseBoolean(String text)
{
if (text == null)
{
return false;
}
return text.equalsIgnoreCase("TRUE") || text.equalsIgnoreCase("Y");
} | 2 |
public String[] getTableRenameStatements(String oldTableName, Class<?> oldClass, String newTableName, Class<?>newClass)
{
StringBuilder sb = new StringBuilder("ALTER TABLE ");
sb.append(oldTableName);
sb.append(" RENAME TO ");
sb.append(newTableName);
return new String[]{sb.toString()};
} | 2 |
private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... | 1 |
void begin() {
while(true){
if(toDo.isEmpty() == true){
toDo.add(new DefaultState(as));
toDo.addAll(done);
//toDo.add(new DefaultState(as));
done.clear();
}
else{
toDo.peek().show();
Event event = toDo.poll();
//done.offer(event);
//use event to call next
Event e... | 3 |
private void checkOnePair() {
for (int i = 0; i < 13; i++) {
if (getNumberOfValues(i) == 2) {
myEvaluation[0] = 2;
myEvaluation[1] = i;
myEvaluation[2] = i;
myEvaluation[3] = 0;// Find leftover card
}
}
} | 2 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
HttpSession sesionOk = request.getSession();
if (sesionOk.getAttribute("usuario") != null) {
response.setContentType("text/html;charset=UTF... | 7 |
@Override
public String toString() {
return comp + "%" + field.getName() + " - " + (data == null ? null : data.getValue());
} | 1 |
public void setName(String s) {
if (FileUtilities.isRelative(s))
s = FileUtilities.getCodeBase(page.getAddress()) + s;
hotLink = s;
miJNLP.setEnabled(FileUtilities.isRemote(hotLink));
if (linkPropertiesDialog == null)
linkPropertiesDialog = new LinkPropertiesDialog(page);
linkPropertiesDialog.setLink(s)... | 8 |
public String getCode(){
int paramPullCount = paramlist!=null ? paramlist.tLineCount() : 0;
String str = this.printLineNumber(true) +
"goto := " + String.valueOf(this.currentLineNumber + paramPullCount + compoundStatement.tLineCount()+4) +"\n";
str += this.printLineNumber(true) + "label := " + name.getN... | 2 |
public int firstMissingPositive(int[] A) {
int len = A.length;
if(len == 1 && A[0] != 1) return 1;
int i = 0;
while (i<len){
if(A[i] != (i+1) && A[i] >= 1 && A[i] <= len && A[A[i]-1] != A[i]){
int temp = A[i];
int index = A[i]-1;
A... | 9 |
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (debug) {
log("filtroAutenticacion:doFilter()");
}
doBeforeProcessing(request, response);
Throwable pro... | 6 |
public static void main(String[] args){
Display d = new Display(1000,800,"Software Renderer - Running: " + args[0]);
Bitmap target = d.getFrameBuffer();
StarfieldRenderer sr = null;
if(args[0].equalsIgnoreCase("starfield"))
sr = new StarfieldRenderer(Integer.parseInt(args[1]), (float)Integer.parseInt(args[2]... | 6 |
public PropertiesManager() {
FileInputStream propFile = null;
try {
propFile = new FileInputStream(FILENAME);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
properties = new Properties(System.getProperties());
try {
properties.load(propFile);
} ca... | 2 |
public static boolean checkZone() {
try {
if (!file.exists()) {
file.mkdir();
}
return true;
} catch (Exception e) {
return false;
}
} | 2 |
public boolean checkThreefoldRepititionRule() {
return false;
} | 0 |
public void testConstructor_ObjectStringEx1() throws Throwable {
try {
new MonthDay("T10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} | 1 |
public static void testCycNumber() {
System.out.println("\n*** testCycNumber ***");
final CycNumber one = new CycNumber(1);
assertTrue(one instanceof CycDenotationalTerm);
assertTrue(one.equalsAtEL(1));
final CycNumber oneTwoThree = CycObjectFactory.makeCycNumber(123);
assertTrue(oneTwoThree ins... | 1 |
public static String sendGet(String url,HashMap<String, String> propertyMap){
InputStreamReader inr = null;
try{
System.out.println("get>>>"+url);
URL serverUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) serverUrl.openConne... | 8 |
public final boolean isAlive() {
return wasStarted() && !myServerSocket.isClosed() && myThread.isAlive();
} | 2 |
public void create(Article article) throws RollbackFailureException, Exception {
if (article.getCommentList() == null) {
article.setCommentList(new ArrayList<Comment>());
}
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
... | 9 |
public void receive()
{
ActiveMQConnection connection = null;
try
{
BrokerService broker = BrokerFactory.createBroker(
"broker:(" + BROKER_URL + ")?" + BROKER_PROPS);
broker.start();
ActiveMQConnectionFactory cf =
new ActiveMQConnectionFactory(Subscriber.BROKER_URL);... | 5 |
public void backup() {
if(_outs != null && _outs[0] != null) {
_backupouts = _outs[0].toString();
for(int i=1; i<_outs.length; i++) {
_backupouts += "," + _outs[i];
}
}
if(_ins != null && _ins[0] != null) {
_backupins = _ins[0].toString();
for(int i=1; i<_ins.length; i++) {
_backupins +=... | 6 |
public void processPath( PackageManager packageManager, String source )
throws IOException
{
this.transformer = new JavaCodeTransform( packageManager );
DirectoryScanner ds = new DirectoryScanner();
// I'm not sure why we don't use the directoryScanner in packageManager,
// ... | 4 |
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 String mv(String src, String dest) {
String result = cp(src, dest);
if (result != null) {
return result;
}
return rm(src);
} | 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.