text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Map(int[][] values, Tuple startPoint, Tuple endPoint, Tuple winning){
if(startPoint.getX()>values.length || endPoint.getX()>values.length || startPoint.getY()>values[0].length ||
endPoint.getY()>values[0].length){
throw new IndexOutOfBoundsException();
}
start = startPoint;
end = endPoint;
heigh... | 4 |
private void jTableProductosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProductosMouseClicked
// TODO add your handling code here:
try {
Cant = Integer.parseInt(JOptionPane.showInputDialog("Cantidad"));
String input = Integer.toString(Cant);
... | 9 |
private List<String> getHtmlStrings(boolean useRed) {
final List<String> htmlStrings = new ArrayList<String>();
final int limit = 4;
int start;
final int skip = higherErrorPosition - limit + 1;
if (skip <= 0) {
start = 0;
} else {
if (skip == 1) {
htmlStrings.add("... (skipping 1 line) ...");
... | 9 |
void paintMeasurementString(int x, int y, int z, int radius, short colix,
boolean rightJustify, int yRef) {
if (!showMeasurementNumbers)
return;
// XIE
if(viewer instanceof ExtendedViewer) {
measurement.formatMeasurement();
}
if (!doJustify) {
rightJust... | 8 |
public ArrayList<Administrador> getById(Administrador admin){
PreparedStatement ps;
ArrayList<Administrador> admins = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Administradores WHERE userName=?");
ps.setString(1, admin.getNombre());
Re... | 4 |
private static final void packNPCSpawns() {
Logger.log("NPCSpawns", "Packing npc spawns...");
if (!new File("data/npcs/packedSpawns").mkdir())
throw new RuntimeException(
"Couldn't create packedSpawns directory.");
try {
BufferedReader in = new BufferedReader(new FileReader(
"data/npcs/unpackedSpa... | 9 |
@SuppressWarnings("unchecked")
private static void getProducts()
{
Object productsRecord = SerialFileHandler.readObject(supplier.getName() + ".dat");
if ((productsRecord != null) && (productsRecord.getClass() == HashMap.class))
products = (HashMap<Serializable, Product>) productsRecord;
else
products = ne... | 2 |
public synchronized void registerConnection(Socket socket) {
openConnections.add(socket);
} | 0 |
private Matrix getSubmatrix(Matrix matrix, int currentLine) {
Matrix subMatrix = new Matrix(matrix.size - 1);
for(int rows = 0; rows < subMatrix.size; rows++) {
for(int columns = 0; columns < subMatrix.size; columns++) {
subMatrix.setValue(rows, columns,
... | 3 |
private <T> List<T> lazyInit(List<T> list) {
if (list == null) {
return new ArrayList<T>(1);
} else {
return list;
}
} | 1 |
private static boolean _find(String path) {
File file = new File(path);
File[] listFiles = file.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
// exclude dot files
if (name.startsWith(".")) {
return false;... | 4 |
public static StateObject getStateObject(int objectX, int objectY, int objectHeight, int objectId)
{
for (StateObject so : stateChanges)
{
if(so == null)
continue;
if(so.getHeight() != objectHeight)
continue;
if(so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY)
... | 6 |
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
MediaLibAccessor srcAccessor = new MediaLibAccessor(sources[0],
destRect,fo... | 9 |
public void ungetc() {
if (idx > 0) {
idx--;
}
} | 1 |
public List<Interval> insert(List<Interval> intervals, Interval newInterval) {
List<Interval> res = new ArrayList<>();
intervals.add(newInterval);
Collections.sort(intervals, new Comparator<Interval>() {
@Override
public int compare(Interval o1, Interval o2) {
... | 9 |
public CodePanel(JFrame frame, int lvl){
frame.setSize(300, frame.getSize().height);
// this.setSize(frame.getSize());
int[] codes = new int[10];
Random rand = new Random(System.currentTimeMillis());
String codeStr = "";
for(int i = 0; i < lvl; i++){
do{
codes[i] = rand.nextInt()%100;
} while(codes... | 3 |
Auction[] search(String criteria){
ArrayList<Auction> temp = new ArrayList<Auction>(searches.values());
for(Auction auc : temp){
if(auc.getName().equalsIgnoreCase(criteria)){
temp.add(auc);
}
}
return temp.toArray(new Auction[temp.size()]);
} | 2 |
public boolean isYourMove() throws InterruptedException {
boolean test = false;
if (test || m_test) {
System.out.println("OthelloAI :: isYourMove() BEGIN");
}
setYourTurn(true);
if (!(getGame().getPlayer1() instanceof Human ||
getGame().getPlayer2() instanceof Human)){
sendMove();... | 6 |
public void run(int n) throws InterruptedException {
File f = new File("Stats.csv");
BufferedWriter bw;
try {
bw = new BufferedWriter(new FileWriter(f));
bw.write("Requin;Poisson\n");
for (int i = 0; i < n; i++) {
runOnce();
int requin = 0;
int poisson = 0;
for (AgentAbs agent : agents) {... | 4 |
public Player getPlayer() {
return Bukkit.getPlayerExact(player);
} | 0 |
public void clearCode() {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
if (ClassEditor.DEBUG) {
System.out.println("Clearing code");
Thread.dumpStack();
}
code.clear();
tryCatches.clear();
... | 2 |
synchronized private boolean moreProviders() {
for (;;) {
while (classNames == null) {
if (!configFiles.hasMoreElements())
return false;
classNames = parseConfigFile((URL)configFiles.nextElement());
}
while (classNames.hasMoreElements()) {
String className = (String)classNames.nextElement();... | 9 |
private void sendBiColor(int first, DisplayMessage m, int height,
int width, BitmapLine firstLine) {
// On envoi en bi
// System.out.println("BI: " + toX + " , " + (toY + first) + " " + width
// + " x " + height);
if (width > 32) {
for (int i = 0; i < height; i++) {
sendBiColorLine(pixels, width, i +... | 8 |
public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... | 7 |
public Value get(Key key) {
Node node = root;
while (node != null) {
int cmp = key.compareTo(node.key);
if (cmp < 0)
node = node.left;
else if (cmp > 0)
node = node.right;
else
return node.value;
}
... | 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 JSONObject getRegionList(String filter, Integer countryCode, Integer limit, Integer offset, String orderBy, String direction) {
StringBuilder uriBuilder = new StringBuilder("/api/getCityList?") ;
log.debug("Setting API Token") ;
uriBuilder.append("AUTH_TOKEN="+apiToken) ;
if (filter!=null) {
uriBuil... | 8 |
private void init(DateTime dt, TimeZone timeZone) {
this.tz = timeZone != null ? timeZone : dt.config().getOutputTimeZone();
long millis = dt.toMillis();
// Compensate for difference between the system time zone and the recorded time zone
long duration = millis - GREG_EPOCH_UTC + timeZon... | 6 |
void assignDealerButton()
{
for (ListIterator<Player> i = players.listIterator(); i.hasNext(); )
{
Player currentPlayer = i.next();
if (currentPlayer.dealerButton == true)
{
System.out.println(currentPlayer+" had dealer button.");
c... | 2 |
static void printBinaryLong(String s, long l) {
System.out.println(s + ", long: " + l + ", binary:\n " +
Long.toBinaryString(l));
} | 0 |
public static byte[] agentOptionToRaw(Map<Byte, String> map) {
if (map == null) {
return null;
}
ByteArrayOutputStream buf = new ByteArrayOutputStream(64);
DataOutputStream out = new DataOutputStream(buf);
try {
for (Entry<Byte, String> entry : map.entrySet()) {... | 4 |
public boolean equals(Material m) {
if (m == null)
return false;
for (int i = 0 ; i < 3 ; i++)
if (ambient[i] != m.ambient[i]) return false;
for (int i = 0 ; i < 3 ; i++)
if (diffuse[i] != m.diffuse[i]) return false;
for (int i = 0 ; i < 4 ; i++)
if (specular[... | 8 |
public static void quickSort(int[] arr, int b, int e){
int i = b, j = e, m = arr[(b+e)/2];
while(i<j){
while(arr[i] < m) i++;
while(arr[j] > m) j--;
if(i<=j)swap(arr, i++, j--);
}
if(i < e)quickSort(arr, i, e);
if(j > b)quickSort(arr, b, j);
} | 6 |
public synchronized void graph(double[] data, double color) {
// long time0 = System.nanoTime();
// System.out.println("WaterfallGraph, graph, start, " + time0);
if (dataAxisAuto) {
//minData = Double.POSITIVE_INFINITY;
//maxData = Double.NEGATIVE_INFINITY;
for ... | 9 |
public static boolean makeFile(File file, boolean directory)
{
if(file.exists())
{
if(file.isDirectory() != directory)
{
file.delete();
}
else
{
return false;
}
}
if(!file.exists())
{
File f = directory ? file : file.getParentFile();
if(f != null && !f.exists())
{
f.mkd... | 8 |
protected boolean isTurnLeft(int row) {
if (row % 2 == 0 && !SimpleCollector.isInitialTurnLeft)
return false;
else if (row % 2 != 0 && SimpleCollector.isInitialTurnLeft)
return false;
else
return true;
} | 4 |
private void subcategorizePredicates(List<SyntaxTreeNodeLeaf> result, DependencyParse dependencyParse,
String preposition, SyntaxTreeNodeLeaf np, Category prepositionCategory)
{
for (Dependency dependencyToArgumentNP : dependencyParse.getPredicates(np)) {
SyntaxTreeNodeLeaf predicate = dependencyToArg... | 9 |
@Override
public void unInvoke()
{
final Physical affected=this.affected;
final Room R=this.destR;
final Room boxR=this.boxR;
super.unInvoke();
if((affected instanceof MOB)&&(R!=null))
{
final MOB mob=(MOB)affected;
if(mob.location()==boxR)
{
mob.tell(L("You feel yourself being unloaded from ... | 7 |
String removeWhiteSpaces(String str) {
String strNoWs = "";
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) != ' ') strNoWs += str.charAt(i);
}
return strNoWs;
} | 2 |
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 |
public void accept(Visitor visitor) {
if (visitor.visit(this)) {
for (Name name : getNames()) {
name.accept(visitor);
}
for (ParentFamilyRef parentFamilyRef : getParentFamilyRefs()) {
parentFamilyRef.accept(visitor);
}
for (SpouseFamilyRef spous... | 6 |
public JTextPane getRightChatBox()
{
return rightChatBox;
} | 0 |
static final boolean method1980(Class123 class123, int i) {
anInt9371++;
try {
if (i != 4096) {
method1981(26);
}
return FloatBuffer.method2249(class123, -128);
} catch (java.io.IOException ioexception) {
if (Class151.anInt1843 == 9) {
class123.aClass365_1557 = null;
return false;
}
... | 9 |
@Override
public void move(Excel start, Excel finish) {
for(int i=0;i<allex.size();i++)
{
if (start.getX() == allex.get(i).getX() && start.getY() == allex.get(i).getY())
{
allex.remove(i);
allex.add(i, finish);
setColoredExes();
break;
}
}
dragg(start, finish);
} | 3 |
public RoutingClient(String localIp, String adyacentNode, String name){
adyacentIp = adyacentNode;
try {
System.out.println("Starting a new client");
InetAddress address = InetAddress.getByName(adyacentIp);
//socket = new Socket(address, ROUTING_CLIENT_PORT);
... | 4 |
@Override
public void mouseClicked(MouseEvent e)
{
super.mouseClicked(e);
if (e.getButton() == MouseEvent.BUTTON1)
{
if (e.getClickCount() == 2)
new FilePlayer(item.getMedias().toArray(new MediaElement[item.getMedias().size()])).execute();
}
else if (e.getButton() == MouseEvent.BUT... | 3 |
protected void getSelectedPanel(InterName name, JPanel owner) {
owner.removeAll();
switch (name) {
case 拉格朗日插值:
owner.add(getLaPanel());
break;
case 牛顿插值:
owner.add(getNePanel());
break;
case 埃尔米特插值:
... | 5 |
protected void filter() throws LexerException
{ // if we are in the comment state
if(state.equals(State.COMENTARIO))
{ // if we are just entering this state
if(comment == null)
{ // The token is supposed to be a comment.
// We keep a reference to it and set the count to one
comment... | 6 |
public int getDefaultCharge()
{
int col = getCol();
if(col == 0 || col == 1)
return col;
else if(col == 13)
return 3;
else if(col == 14)
return 4; //remember that this could be plus or minus 4
else if(col == 15)
return -3;
else if(col == 16)
return -2;
else if(col == 17)
return -1;
... | 7 |
public static String encrypt(String filename)
{
String superString="";
Scanner fin=new Scanner(System.in);
try
{
fin=new Scanner(new FileReader(filename));
}
catch(Exception e){e.printStackTrace();}
while(fin.hasNextLine())
{
String line=fin.nextLine();
for(int i=0; ... | 3 |
public void nextCycle(Node lnode, int protocolID)
{
for (int i=0; i < pid.length; i++) {
// Select peer; exit if not found
EpidemicProtocol lpeer = (EpidemicProtocol) lnode.getProtocol(pid[i]);
Node rnode = lpeer.selectPeer(lnode);
if (rnode == null )
continue;
EpidemicProtocol rpeer = (EpidemicProtocol)... | 9 |
public void propagatePhis(Environment env, BasicBlock joinBlock) throws Exception {
for(Instruction i : instructions) {
if(i instanceof Phi) {
Phi phi = (Phi)i;
Identifier variable = phi.getVariable();
Value oldVal = env.get(variable);
if(joinBlock != null) {
joinBlock.addPhi(variable, oldVal, phi);... | 3 |
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RetrievalMethod")
public JAXBElement<RetrievalMethodType> createRetrievalMethod(RetrievalMethodType value) {
return new JAXBElement<RetrievalMethodType>(_RetrievalMethod_QNAME, RetrievalMethodType.class, null, value);
} | 0 |
int evaluate(Move m, Board b, int depth, Side s) {
if (depth <= 0) {
return value(b, s);
}
Side player = m.movingPiece(b).side();
int alpha = player == s ? -1 : 1;
MutableBoard next = new MutableBoard(b);
next.makeMove(m);
Iterator<Move> moves = next.l... | 4 |
public EditMenu() {
super();
} | 0 |
private void getBylineText(StringBuilder sbByline, StringBuilder sbSourceText,
boolean removeExtractedText) {
// get byline, byline title, place and remove it from the source text
String strByline = getTaggedTextByCategory(tcHM, "BYLINE", sbSourceText, removeExtractedText);
... | 3 |
@Override
public void action() {
ACLMessage msg = myAgent.receive(msgFilter);
if (msg != null) {
if(msg.getConversationId() == null) {
String log = "ConversationId == null : sender: " + msg.getSender().getLocalName()
+ "; content: " + msg.getConten... | 6 |
public static float toFloat(Object object) {
if (object instanceof Number) {
return ((Number) object).floatValue();
}
try {
return Float.valueOf(object.toString());
} catch (NumberFormatException e) {
} catch (NullPointerException e) {
}
r... | 3 |
public static String[] getSeriesOfInputs(String query) {
System.out.println("Enter multiple values below. When done, enter an empty response to proceed.");
ArrayList responseList = new ArrayList();
boolean done = false;
while (!done) {
String response = ConsoleTools.getInput(" " + query);
if (respo... | 4 |
private void carregarArquivo(String diretorio) {
//openAguarde();
// TODO Colocar a parte de leitura para a classe GerenciarArquivo.java
try {
FileInputStream file = new FileInputStream(new File(jTextCaminho));
//boolean copyCellContent = false;
//Create ... | 5 |
public LinkedList<E> toLinkedList()
{
LinkedList<E> result = new LinkedList<>();
if (isEmpty()) return result;
Queue<Node> q = new Queue<>();
q.enqueue(root);
while (!q.isEmpty())
{
Node u = q.dequeue();
result.add(u.key);
if (u.le... | 4 |
public static void main(String[] args) throws IOException, InterruptedException {
File testDir = new File(System.getProperty("java.class.path") + "/../tests/pa4_tests");
int failures = 0;
for (File x : testDir.listFiles()) {
if (x.getName().startsWith(".") || x.getName().endsWith("mJ... | 9 |
private void LerBDMateriaPrimaComboBox(JComboBox ComboBoxMateriaPrima, String VerEstadoAMostrar) {
ComboBoxMateriaPrima.removeAllItems();
//CARREGAR DADOS
Set<String> opcao = new HashSet<String>();
//VERIFICAR QUAL O ESTADO QUE VAMOS MOSTRAR
boolean estado = false;
bool... | 9 |
public void checkVerticalCollision(Rectangle rtop, Rectangle rbot) {
if (rtop.intersects(r)) {
}
if (rbot.intersects(r) && type == 8) {
robot.setJumped(false);
robot.setSpeedY(0);
robot.setCenterY(tileY - 63);
}
} | 3 |
public static void main(String[] args) {
Employees employees = new Employees(2);
Scanner sc1 = new Scanner(System.in);
Scanner sc2 = new Scanner(System.in);
boolean finished = false;
while (!finished) {
System.out.print("Enter new employee ID: ");
... | 6 |
public void actionPerformed(final ActionEvent e)
{
if (e.getActionCommand().equals("join"))
{
this.nickname = typedText.getText();
this.join.setEnabled(false);
typedText.setText("");
typedText.requestFocusInWindow();
if (this.client.join(this.nickname))
{
this.open... | 4 |
public void inputHandler() {
if(Keys.isPressed(Keys.ESCAPE)) gsm.setPaused(false);
if(Keys.isPressed(Keys.ENTER)) select();
if(Keys.isPressed(Keys.UP)) {
if(currentChoise > 0) {
// AudioBox.play("menuChanged", 0);
currentChoise--;
}
}
if(Keys.isPressed(Keys.DOWN)) {
... | 6 |
public void setInitialWidth(int initialWidth) {
this.initialWidth = initialWidth;
} | 0 |
public ArrayList<Long> getStringAsLongList(String name)
{
List<String> value_list = strings_map.get(name);
ArrayList<Long> result = new ArrayList<Long>();
if(value_list == null)
{
return result;
}
for(String val:value_list)
{
try
{
result.add(Long.valueOf(val... | 3 |
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append(isQuery() ? "dns[query," : "dns[response,");
//buf.append(packet.getAddress().getHostAddress());
buf.append(':');
//buf.append(packet.getPort());
//buf.append(",len=");
//buf.append(p... | 9 |
public void update(){
int num=buttonSelected();
if(scrollUp!=null&&scrollUp.getIndex()==num)
scrollUp();
if(scrollDown!=null&&scrollDown.getIndex()==num)
scrollDown();
if(accept!=null&&accept.getIndex()==num)
add();
if(reject!=null&&reject.getI... | 8 |
public Vector4 abs() {
if(x < 0) x = -x;
if(y < 0) y = -y;
if(z < 0) z = -z;
if(w < 0) w = -w;
return this;
} | 4 |
public static void sortMaps () {
mapPanels.clear();
maps.removeAll();
currentMaps.clear();
int counter = 0;
selectedMap = 0;
maps.repaint();
LaunchFrame.updateMapInstallLocs(new String[] { "" });
mapInfo.setText("");
HashMap<Integer, List<Map>> sor... | 8 |
public static void drawCreatorPoints(Graphics g, List<Point> creatorPoints) {
for (int i = 0; i < creatorPoints.size(); i++) {
Point point = creatorPoints.get(i);
for (int j = 1; j <= Constants.POINT_RADIUS; j++) {
drawCircle(g, (int)point.getX(), (int)point.getY(), j, Color.WHITE);
}
}
} | 2 |
public static GuiThreatSelection getInstance(Component component) {
Container parent = component.getParent();
while (parent != null)
if (parent instanceof GuiThreatSelection)
return (GuiThreatSelection) parent;
else
parent = parent.getParent();
return null;
} | 2 |
static final void addConsoleMessage(String string) {
anInt6++;
if (Class286_Sub1.consoleMessages == null)
Class14_Sub3.method249(2);
Class286_Sub3.aCalendar6221.setTime(new Date(Class62.getCurrentTimeMillis()));
int i_8_ = Class286_Sub3.aCalendar6221.get(11);
int i_9_ = Class286_Sub3.aCalendar6221.get(12);
i... | 7 |
private void fillUsers(List<User> users, AbstractDao dao) throws DaoException {
for (User u : users) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_ROLE, u.getRole().getIdRole());
u.setRole(dao.findRoles(crit).get(0));
}
} | 1 |
@SuppressWarnings("deprecation")
public static NeuralNet[] learnTiles(WritableRaster[] wrs, char[] ls, int nInps, NeuralNetListener listener) {
assert (wrs.length == ls.length);
int[] colCharInd = colCharInd();
int[][] colIndChar = colIndChar();
// Find out how many tiles there are of each letter
int[] nLet ... | 8 |
public static Boolean map_exit(String str, HashMap<String, Integer>map){
Iterator it=map.entrySet().iterator();
@SuppressWarnings("rawtypes")
Map.Entry entry;
while(it.hasNext()){
entry=(Entry) it.next();
String str2=entry.getKey().toString();
if(str2.equals(str)){
return false;//Already exist
... | 2 |
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integ... | 6 |
public String mapMethodName(String owner, String name, String desc) {
String s = map(owner + '.' + name + desc);
return s == null ? name : s;
} | 1 |
private void initView() {
// Set up the table.
table = new GrammarTable(model);
table.setTableHeader(new JTableHeader(table.getColumnModel()));
table.getTableHeader().setReorderingAllowed(false);
table.getTableHeader().setResizingAllowed(true);
TableColumn lhs = table.getColumnModel().getColumn(0);
TableC... | 0 |
public Drawable buildDrawable(int type,int originX,int originY, int width, int height){
Drawable toReturn = null;
if(type == Drawable.LINE){
toReturn = new Line(originX, originY, width, height, figures.size(),toolbox.getBordure());
}else if(type == Drawable.RECTANGLE){
toReturn = new Rectangle(originX, orig... | 8 |
private final void functionCall(Class resolveInClass,String name,
int paramsStart) throws CompilationException{
// collect params
int np=paramOPs.size()-paramsStart;
Class[] params=new Class[np];
for(int i=np-1;i>=0;i--) {
OP cop=(OP)paramOPs.pop();
xchgOP.... | 4 |
private void drawCreated(Graphics g) {
pulse();
float alpha;
int auraSize = FRAME_WIDTH / 100;
for (int i = 0; i < auraSize; i++) {
alpha = (float) ((auraSize - i) * 1.0 / auraSize);
g.setColor(new Color(1, 1, 1, alpha));
g.drawOval(x - i, y - i, widt... | 1 |
public void getAllProfiles() throws IOException, ServiceException {
ArrayList<ContactEntry> profiles = new ArrayList<ContactEntry>();
URL feedUrl =
new URL("https://www.google.com/m8/feeds/profiles/domain/" + this.domain
+ "/full?xoauth_requestor_id=" + this.adminEmail);
while... | 4 |
public void deletePlaylist(BEPlaylist aPlaylist) throws Exception {
try {
ds.deletePlaylist(aPlaylist);
} catch (SQLException ex) {
throw new Exception("Could not get playlist " + aPlaylist.getId());
}
} | 1 |
@Deprecated public int getLabelIndex(String label){
try {
return getLabelIdx(label);
} catch (IOException iox){
return -1;
}
} | 1 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (horizontal ? 1231 : 1237);
result = prime * result + identifier;
result = prime * result + length;
result = prime * result
+ ((position == null) ? 0 : position.hashCode());
return result;
} | 2 |
@Override
public void run() {
for (;;) {
try {
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
DataInputStream in = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
DataOutputS... | 8 |
@Override
public void run() {
try {
while (true) {
selector.select();
for (Iterator<SelectionKey> it = selector.selectedKeys()
.iterator(); it.hasNext();) {
SelectionKey key = it.next();
it.remove();
if (key.isAcceptable()) {
accept(key);
} else if (key.isReadable()) {
... | 6 |
final void setAxes(Mesh m) {
m.axis = new Vector3f(0, 0, 0);
m.axes = new Vector3f[m.polygonCount > 0 ? m.polygonCount : 1];
if (m.vertices == null)
return;
int n = 0;
for (int i = m.polygonCount; --i >= 0;) {
int[] p = m.polygonIndexes[i];
m.axes[i] = new Vector3f();
if (p.l... | 8 |
public void renderPixelTrans(int x, int y, int col, float trans){
if(x < 0 || y < 0 || x >= width || y >= height) return;
pixels[x + y * width] = blend(col, pixels[x + y * width], trans);
} | 4 |
private void moveWormAndEatBacteriaIfAble(Worm thisWorm, int newX, int newY) {
if (Level[newX][newY] != null && Level[newX][newY].is(Bacteria.class)) {
Bacteria thisBact = (Bacteria) Level[newX][newY];
thisWorm.eatBacteria(thisBact.getEaten());
}
Level[newX][newY] = thisW... | 3 |
public int getDepth() {
TreeContainerRow parent = mParent;
int depth = 0;
while (parent != null) {
depth++;
parent = parent.mParent;
}
return depth;
} | 1 |
private static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws IllegalArgumentException {
if (!items.containsKey(key)) {
throw new IllegalArgumentException("Schematic file is missing a \"" + key + "\" tag");
}
Tag tag = items.get(key);
if (!expected.isInstance(tag)... | 2 |
public Tetromino()
{
this.type = TetrominoType.getRandomTetrominoType();
colOffset = Board.WIDTH/2;
rowOffset = 0;
switch (type)
{
case O:
representation = new boolean[2][2];
representation[0][0] = true;
representation[0][1] = true;
representation[1][0] = true;
representation[1][1] = true;
... | 7 |
public int getPop(int size){
if (resource2==4){
if (size==1){
return sgenrate2;
}
else if (size==2){
return mgenrate2;
}
else {
return lgenrate2;
}
}
else{
return 0;
}
} | 3 |
public boolean writeToFile(String fileName, String dataLine,
boolean isAppendMode, boolean isNewLine) {
if (isNewLine) {
dataLine = "\n" + dataLine;
}
try {
File outFile = new File(fileName);
if (isAppendMode) {
dos = new DataOutputStream(new FileOutputStream(fileName, true)... | 4 |
private boolean read_serialize(String fileName) {
boolean readSuccessful = false;
FileInputStream iStream = null;
boolean EOF = false;
try {
iStream = new FileInputStream(fileName);
ObjectInputStream objStream;
objStream = new ObjectInputStream(iStream);
while(!EOF) {
try {
//tr... | 8 |
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.