text stringlengths 14 410k | label int32 0 9 |
|---|---|
public double[][] createStockLattice(int rows, int cols, double s0,
double up)
{
stk_lat = new double[rows][cols];
//rev_lat = new double[rows][cols];
for(int i = 0; i <= stk_lat.length; ++i)
{
if(i > 0)
{
... | 6 |
@Deprecated
public void onEvent(bluefrost.serializable.objects.v1.KeyObject event){
try{
synchronized(ClientManager.map.inverse().get(event.getSocketChannel())){
Client c = ClientManager.map.inverse().get(event.getSocketChannel());
if(c.isLoggedIn() == true){
c.setKey(Crypto.randomAESKey());
Mai... | 2 |
public byte[] getFileBytes(short fid) {
byte[] result = filesBytes.get(fid);
if (result != null) {
return result;
}
InputStream in = getInputStream(fid);
if (in == null) {
return null;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[256];
while (true) {
try {
... | 5 |
private synchronized void resetPeerRates() {
for (SharingPeer peer : this.connected.values()) {
peer.getDLRate().reset();
peer.getULRate().reset();
}
} | 1 |
public StructuredBlock getNextBlock(StructuredBlock subBlock) {
if (subBlock == subBlocks[0]) {
if (subBlocks[1].isEmpty())
return subBlocks[1].getNextBlock();
else
return subBlocks[1];
}
return getNextBlock();
} | 2 |
TreeNode<K,V> getLcaWithoutParent(TreeNode<K,V> root, TreeNode<K,V> p, TreeNode<K,V> q){
if (root == null)
return null ;
TreeNode left = getLcaWithoutParent(root.left, p, q);
TreeNode right = getLcaWithoutParent(root.right, p, q);
// 5 cases !
if (root == p || root ... | 9 |
private void radiusSearchHelper(E target, KDNode top, double radiusSquare, PriorityQueue<E> neighbors, DistComparator<E> distComp) throws VariedDimensionException {
Stack<KDNode> parents = new Stack<KDNode>();
findLeaf(target,top,parents);
KDNode currentNode = null;
KDNode lastNode = null;
while (!parents.... | 9 |
public static void playSound(Sound sound, boolean important){
if(MyGame.mute) return;
long currentTime = System.currentTimeMillis();
int newIndex = -1;
float lowestTime = Float.MAX_VALUE;
for(int i = 0; i < maxBufferSize; i++){
if(currentTime - soundTimer[i] > 3000 || soundBuffer[i] == null){
newInd... | 8 |
private void paintAllShoots(Graphics2D g2) {
for (Tower currentTower : board.getAllTowers()) {
if (currentTower.hasTarget()) {
// for (Placeable currentObj : currentTower.getPlacablesWithinRangeOfThisTower()) {
for (Placeable currentObj : currentTower.getCurrentTargets... | 4 |
private void arrayDeclaration()
{
if (accept(NonTerminal.ARRAY_DECLARATION))
{
tryDeclareSymbol(current);
expect(Token.Kind.IDENTIFIER);
expect(Token.Kind.COLON);
type();
expect(Token.Kind.OPEN_BRACKET);
expect(Token.Kind.INTEGER);
expect(Token.Kind.CLOSE_BRACKET);
while (accept(Token.Kind.... | 2 |
@Override
public boolean updateProject(Long projectid, Long rowId, String newValue) {
try{
Project project = entityManager.find(Project.class, projectid);
if(rowId == 1){
project.setProjectname(newValue);
}else if(rowId == 2){
Long newHostId = Long.parseLong(newValue);
project.setHostid(newHostI... | 5 |
public void setPower(double power) {
if (power < 0 && getPotValue() >= FULL_FORWARD_POSITION || power > 0 && getPotValue() < FULL_BACKWARD_POSITION || Math.abs(power) < .1) {
power = 0;
}
motor1.set(power);
motor2.set(power);
} | 5 |
private static ShortImageBuffer fromBufferedImage(BufferedImage input)
{
int w = input.getWidth();
int h = input.getHeight();
ShortImageBuffer greyscale = new ShortImageBuffer(h, w);
byte[] pixels = ((DataBufferByte) input.getRaster().getDataBuffer()).getData();
int index = ... | 2 |
public boolean addNode(Root node) {
return false;
} | 0 |
public Parser.Events parse()
{
int c = 0;
boolean ret = true;
try {
while ((c = in.read()) != -1 && ret)
{
this.charsRead += 1;
ret = this.updateState(c);
if (ret)
{
updateEvent();
... | 8 |
private void initParams(){
if(!iphoneParams.isEmpty()){
postURL = iphoneParams.getProperty("APPLESTORE_POST_URL");
originalPostURL = postURL;
fromPageNum = iphoneParams.getProperty("APPLESTORE_FROM_PAGE_NUM");
ID = iphoneParams.getProperty("APPLESTORE_ID");
relative_URI = iphoneParams.getProperty("APPL... | 7 |
private static void readBojarczukReports() throws FileNotFoundException {
List<Integer> generations = new ArrayList<Integer>();
File[] reports = reportDir.listFiles(new FileFilter() {
public boolean accept(File path) {
return path.getName().startsWith("Iteration_0");
... | 9 |
public void setStatusToIdle(String username){
try {
cs = con.prepareCall("{call setStatusToIdle(?)}");
cs.setString(1, username);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} | 1 |
public ArrayList<String> getAllKeysInGroup(String group){
ResultSet rs;
try{
String key;
ArrayList<String> keys = new ArrayList<String>();
PreparedStatement prep = this.conn.prepareStatement("SELECT key FROM keyval WHERE collection = ?");
prep.setString(1, group);
rs = prep.... | 2 |
public static HashMap<ItemType, ItemData> loadItemStats(String xmlFilePath){
HashMap<ItemType, ItemData> statsMap = new HashMap<>();
NodeList types = getElements(xmlFilePath, "type");
for(int i = 0; i < types.getLength(); i++){
Element typeElement = (Element) types.item(i);
Action action = null;
if(typeE... | 4 |
public static void fixDirs(File target) {
File parent = target.getParentFile();
if (parent != null) {
parent.mkdirs();
}
} | 1 |
public void setMode(final Mode mode) {
if (this.mode != mode) {
clearMouseListeners();
}
System.out.println("Set new mode: " + mode);
this.mode = mode;
switch (this.mode) {
case LINE_DDA:
addLineMouseListeners();
break;
case LINE_BREZENHEM:
addLineMouseListeners();
break;
case LINE_WY:
... | 6 |
@Override
protected void track(int px, int py, int qx, int qy, int iterations) {
dispose();
String[] splitted = Loader.getCurrentFile().getAbsolutePath()
.split("/");
String fileName = splitted[splitted.length - 1];
int x = fileName.indexOf('.');
StringBuffer num = new StringBuffer();
boolean end = fa... | 9 |
public static Keyword rangeTypeSpecialist(ControlFrame frame, Keyword lastmove) {
{ Proposition proposition = frame.proposition;
Stella_Object relation = Logic.argumentBoundTo((proposition.arguments.theArray)[0]);
Stella_Object instance = Logic.argumentBoundTo((proposition.arguments.theArray)[1]);
... | 9 |
public TerritoriesLayout getSubset(PlayerColor owner){
TerritoriesLayout res = new TerritoriesLayout();
Iterator<Integer> iter = m_territories.keySet().iterator();
while(iter.hasNext()){
Integer key = iter.next();
if(m_territories.get(key).getOwner() == owner){
res.put(m_territories.get(key));
}
}
... | 2 |
public DummyChannel() {
dataSemaphore = new Semaphore(0);
dataQueue = new LinkedList<Integer>();
is = new DummyInputStream();
os = new DummyOutputStream();
} | 0 |
private QuadTree initDataStructure() {
getNodes();
getEdges();
//getStreets();
getCoast();
int i = 0;
for (Edge edge : edges) {
if (edge.getRoadType() != 74) {
}
//System.out.println(i++);
}
createQuadTree();
System.o... | 2 |
public void releaseLock(){
synchronized (this) {
if(lockedBy.equalsIgnoreCase("localhost")){
isLOcked = false;
lockedBy = null;
String msg = "Release_Lock" + ":" + lockName;
manager.notifyAllRemoteListeners(new Message(msg, localhost));
}
}
} | 1 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Recurso)) {
return false;
}
Recurso other = (Recurso) object;
if ((this.idRecurso == null && other.idRecurso !=... | 5 |
public void atCondExpr(CondExpr expr) throws CompileError {
booleanExpr(expr.condExpr());
expr.thenExpr().accept(this);
int type1 = exprType;
int dim1 = arrayDim;
String cname1 = className;
expr.elseExpr().accept(this);
if (dim1 == 0 && dim1 == arrayDim)
... | 4 |
@Test
public void keonKasvatusToimiiOikeinTest(){
Siirto siirt1 = new Siirto(11,3,1,7,0, 0); // arvo 4
Siirto siirt2 = new Siirto(8,2,0,3,0, 0); // arvo -10
for (int i = 0; i < 10; i++){
keko.lisaa(siirt2);
}
keko.lisaa(siirt1);
assertEquals(11, ke... | 1 |
protected void invalidate()
{
for(ComponentListener cl: componentListeners)
cl.onComponentInvalidated(this);
if(parent != null && parent instanceof AbstractContainer) {
((AbstractContainer)parent).invalidate();
}
} | 3 |
public static Class<?> createCompositeInterface(Class<?>[] interfaces,
ClassLoader classLoader) {
Assert.notEmpty(interfaces, "Interfaces must not be empty");
Assert.notNull(classLoader, "ClassLoader must not be null");
return Proxy.getProxyClass(classLoader, interfaces);
} | 2 |
public Node getNodeParent() {return this.hoistedNodeParent;} | 0 |
public Class<?>[] getInvokerParameters()
{
return this.invokerParameters;
} | 1 |
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock() != null) { // Will prevent an NPE if the user right-clicks air.
if (event.getBlock().getState() != null) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = null;
try {
... | 8 |
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
httpRequest.getSession();
if (httpRequest.getSession().getAttribute("patron") == null) {
httpRequest.setAttribute("l... | 1 |
public void update(double diff) {
switch (state) {
case MAIN_SCREEN:
break;
case PLAYING:
if (level.isCompleted()) {
state = State.LOADING;
return;
}
for (int i = 0; i < entities.size(... | 7 |
public static BareBonesStatement InterpretLine(String[] Lines, LineReference currentLine, HashMap<String, Integer> Variables) throws BareBonesSyntaxException, BareBonesCompilerException
{
BareBonesStatement returnStatement = null;
String workingLine = Lines[currentLine.getLineNumber()];
workingLine = remov... | 4 |
private void dispatch(String[] commands, Socket s) throws IOException {
PrintWriter writer = new PrintWriter(s.getOutputStream(), true);
switch (commands[0]) {
case AppConstants.GET:
if (commands.length != 2) {
LOG.warning("Insufficient parameters for GET... | 5 |
private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
((m_hasClass == true) && (i !... | 7 |
public void showStars() {
System.out.println("******");
show();
System.out.println("******");
} | 0 |
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// client browser will request the page every 60 seconds
HttpSession session = request.getSession();
Long times = (Long) session.getAttribute("times");
if (times == null) {
session.setAttribute(... | 3 |
private void heapify(int i) {
if (i <= 0 || i >= length) {
return;
}
System.out.println("heapify " + i);
int left = 2*i;
int right = 2*i + 1;
if (right < length) {
//left is smaller
if (heap[left].compareTo(heap[right]) < 0) {
if (heap[i].compareTo(heap[left]) > 0) {
switchTwo(i, lef... | 8 |
public String convert(String str) {
char[] cc = str.toCharArray();
StringBuilder sb = new StringBuilder();
for (char c : cc) {
char newChar = c;
if ((('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z'))
|| (('1' <= c) && (c <= '9')) || is2Sign... | 8 |
private void mergeRegions(double alpha){
for (int i = 0; i < this.denseRegions.size(); i++) {
DenseRegion r1 = this.denseRegions.get(i);
for (int j = 0; j < i; j++) {
DenseRegion r2 = this.denseRegions.get(j);
if(r1.getIsInCluster() && r2.getIsInCluster() && (r1.getClusterID() == r2.getClusterID())... | 8 |
public boolean connect()
{
if (!notificationConnect())
{
boolean redirected = notificationConnect();
if (!redirected) // try again
{
log.debug("MSN Connection failed");
return false;
} else
{
log.debug("MSN connected!!");
}
}
SSLServerConnection sslConn = null;
String strLoginS... | 9 |
public int[][] getObfuscatedSea()
{
int[][] obfuscatedSea = new int[sea.length][sea[0].length];
for(int x = 0; x < sea.length; x++)
{
for(int y = 0; y < sea[0].length; y++)
{
obfuscatedSea[x][y] = sea[x][y];
if(sea[x][y] == SHIP)
obfuscatedSea[x][y] = OCEAN;
}
}
return obfuscatedSea;
} | 3 |
public static TYPE find(String s)
{
if("file".equals(s.toLowerCase()))
return FILE;
else if("function".equals(s.toLowerCase()))
return FUNCTION;
return NONE;
} | 2 |
public boolean download(File targetFile, String url, MavenArtefact artefact, String extension, String preresolvedVersion, boolean metafile) {
try {
buildParentDir(targetFile);
//BUILD HTTP URL
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(url... | 7 |
private void cftbsub(int n, double[] a, int offa, int[] ip, int nw, double[] w) {
if (n > 8) {
if (n > 32) {
cftb1st(n, a, offa, w, nw - (n >> 2));
if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) {
... | 9 |
private void processGridletSubmit(Sim_event ev, boolean ack)
{
try
{
// gets the Gridlet object
Gridlet gl = (Gridlet) ev.get_data();
// checks whether this Gridlet has finished or not
if (gl.isFinished())
{
String name = G... | 4 |
public void delete(String siteName) {
AppUtils.setConsoleMessage("Nom du site : " + siteName, SQLiteDAO.class, MessageType.INFORMATION, 294, AppParams.DEBUG_MODE);
dataDeleted = false;
Connection c = null;
PreparedStatement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = Drive... | 5 |
public void drawSliders() {
if (!Settings.displayGrid) {
return;
}
int background = 0x151515;
int bar = 0x666666;
int thickness = 8;
int start = 150;
if (instance.mouseInRegion(0, instance.getCanvasWidth() - thickness, instance.getCanvasHeight() - thickness, instance.getCanvasHeight())) {
if (instan... | 7 |
public XSSFWorkbook readWorkbook()
{
XSSFWorkbook wbDefault = new XSSFWorkbook();
try
{
String pathname = "";
// check what OS we are running on
String os = System.getProperty("os.name").toLowerCase();
if(os.contains("win")) pathname = "I:\\c... | 4 |
public int maxID(String table, String nameID) {
int n = 0;
try {
con = DriverManager.getConnection(url, user, password);
Statement stmt;
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("select count(*) from " + table);
r... | 4 |
public boolean equals(Object o) {
return (o instanceof TreeElement)
&& fullName.equals(((TreeElement) o).fullName);
} | 1 |
@Override
public void setSocket(Socket socket) {
this.socket = socket;
try {
writer = new PrintWriter(socket.getOutputStream(), true);
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException ex) {
System.out.printl... | 1 |
void shiftPc(int where, int gapLength, boolean exclusive) {
int n = tableLength();
for (int i = 0; i < n; ++i) {
int pos = i * 4 + 2;
int pc = ByteArray.readU16bit(info, pos);
if (pc > where || (exclusive && pc == where))
ByteArray.write16bit(pc + gapL... | 4 |
public static void main(String[] args) {
LoadTexts lf = new LoadTexts();
for (String text : lf) {
System.out.println(text);
}
} | 1 |
public ListNode reverseGroup(ListNode preNode, int k, boolean force) {
ListNode tail = preNode.next;
ListNode current = preNode.next;
ListNode previous = preNode;
ListNode next = current.next;
int i = 0;
for (i = 0; i < k && current != null; i++) {
current.ne... | 5 |
public static boolean threeOfaKind(Hand hand) {
hand.sortByValue();
if(
(hand.getCard(0).getValue() == hand.getCard(1).getValue()) &&
(hand.getCard(0).getValue() == hand.getCard(2).getValue()) ||
(hand.getCard(1).getValue() == hand.getCard(2).getValue()) &&
(hand.getCard(1).getValue() == hand... | 6 |
public boolean check(String t_name) {
for (ClientInfo a : client_list) {
if (a.name.equals(t_name))
return false;
}
return true;
} | 2 |
public Number max(){
Number max = stack.getFirst();
for (T t : stack){
if (max.doubleValue() < t.doubleValue()){
max = t;
}
}
return max;
} | 2 |
public DVClient(int port) {
this.port = port;
} | 0 |
@Override
public void execute (final char command) {
switch (command) {
case UP_MOVE:
moveUp ();
break;
case DOWN_MOVE:
moveDown ();
break;
case LEFT_MOVE:
moveLeft ();
break;
case RIGHT_MOVE:
moveRight ();
break;
... | 6 |
@Override
protected void setColoredExes() {
coloredEx = LineGenerator.Brezenhem(begin, end);
center = coloredEx.get((coloredEx.size() / 2));
} | 0 |
public Boolean findElement(int[][] arrA, int number) {
// start from the left top corner, say ele;
// if ele>number -> move left
// if ele<number -> move right
// if you cant move further to find the number , return false
int row = 0;
int col = arrA[1].length - 1;
boolean numberFound = false;
System.out... | 6 |
private double[][] getSimilarMatrix(IClusterCalculable[] oriData) {
double[][] S = new double[dNum][dNum];//相似矩阵
ArrayList<Double> list_S = new ArrayList<Double>();
// double sum = 0;
for (int i = 0; i < dNum; i++) {
IClusterCalculable data_i = oriData[i];
for (int... | 4 |
public void mouseClicked(int x, int y) {
if(parent.activeBrush < 0){
if(!fill) drawTiles(currentLayer - 1, x, y);
else fillTiles(currentLayer- 1, x, y);
backUpTiles();
}
else{
int tileSize = parent.tilePanel.getTileSize();
int tx = 0;
int ty = 0;
if(x > 0) tx = x/tileSize;
if(y > 0) ty... | 4 |
public final void addGameLayer(GameLayer gameLayer) {
if (!gameLayers.containsKey(gameLayer.getName())) {
gameLayers.put(gameLayer.getName(), gameLayer);
} else {
logger.error("The gamelayer name, ", gameLayer.getName(),
" was not added to the game screen ", getName(),
" as it already exists within ... | 1 |
private boolean acceptsMimeType(final Header header) {
final String value = header.getValue();
if (value == null) {
return false;
}
for (String mimeType : mimeTypesToInclude) {
if (value.contains(mimeType)) {
return true;
}
}
return false;
} | 3 |
public void setConnectingFields() {
for (int i = 0; i < con.getObjPanel().getPrimitiveObjectives().size(); i++) {
JObjective obj = (JObjective) con.getObjPanel().getPrimitiveObjectives().get(i);
BaseTableContainer btc = findPrimitive(obj.getName());
if (btc != null) {
... | 6 |
public static boolean validateDepartment(){
boolean isValid=false;
return isValid;
} | 0 |
public void shutDownConnection() {
System.out.println("Shutdown Connection");
try {
if (out != null)
out.close();
if (in != null)
in.close();
if (fis != null)
fis.close();
if (out != null)
out.close();
if (socket != null)
socket.close();
} catch (Exception e) {
}
} | 6 |
public String process(Payment payment, double amount)
{
String result="null";
PreparedStatement pst;
PreparedStatement pset;
ResultSet rs;
Connection conn;
Connection conn1;
Payment detailsFromDb = new Payment();
try {
conn = DBUtil.getDBConnection("Type4");
pst = conn.prepareStatement(" select... | 7 |
@Override
public Object getValueAt(int i, int i1) {
Carpart carpart = carparts.get(i);
switch (i1) {
case 0:
return carpart.getId();
case 1:
return carpart.getName();
case 2:
return carpart.getPrice();
ca... | 4 |
@Override
public void close()
{
switch( channelType )
{
case SoundSystemConfig.TYPE_NORMAL:
if( clip != null )
{
clip.stop();
clip.flush();
clip.close();
}
brea... | 4 |
public void paint(Graphics g) {
Color colors[] = null;
ButtonModel model = getModel();
if (isEnabled()) {
if (model.isPressed() && model.isArmed()) {
colors = AbstractLookAndFeel.getTheme().getPressedColors();
} else {
... | 8 |
private void deCryptString(String s, int year, String type) {
double[] data = new double[12];
double[] coord = new double[2];
int i = 0;
int idx = 0;
for(int j=0; j<s.length();j++){
if(Character.isWhitespace(s.charAt(j))){
if(j>i && s.substring(i+1, j).length()>1){
if (idx>1){
data[idx-2] = ... | 9 |
public static void main(String[] args) {
Class c = null;
try {
c = Class.forName("com.thinkingjava.rtti.typeinfo.toys.FancyToy");
} catch (ClassNotFoundException e) {
print("Can't find FancyToy");
System.exit(1);
}
printInfo(c);
for (Class face : c.getInterfaces())
printInfo(face);
Class up = ... | 4 |
public void setWeapon(Ship host, GameRenderer renderer, String WeaponName, boolean allyControlled, boolean autonomous) {
double prevWeaponYaw = 0;
if (weapon != null) prevWeaponYaw = getWeapon().getYaw();
if (WeaponName.equals("TwinFiveInch")) {
weapon = new TwinFiveInch(host, rende... | 8 |
public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<>();
if (root == null)
return result;
Queue<TreeNode> queue = new LinkedList<>();
queue.add(root);
int currentLevel = 1;
int nextLevel = 0;
int lev... | 6 |
public void leaveSomeOutSplit(int index, String filename) {
List<Bookmark> trainLines = new ArrayList<Bookmark>();
List<Bookmark> testLines = new ArrayList<Bookmark>();
int currentUser = -1;
int userIndex = 0;
Collections.sort(this.reader.getBookmarks());
int cntUsers=0;
for (Bookmark data : this.r... | 5 |
@SuppressWarnings("rawtypes")
@Override
public PduResponse firePduRequestReceived(PduRequest pduRequest) {
// Check receiver type
if(config.get("type").equals("MO")){
//Process MO parse
// Check type of PDU
if (pduRequest.getCommandId() == SmppCon... | 7 |
public void actionPerformed(ActionEvent ae) {
String actionCommand = ae.getActionCommand();
if(MODIFY_NAME.equals(actionCommand)) {
AccountActions.modifyAccountNames(tabel.getSelectedObjects(), accounts);
} else if(MODIFY_TYPE.equals(actionCommand)){
AccountActions.modifyAccountTypes(tabel.getSelectedObject... | 5 |
@Override
public void receivePacket(Packet packet) {
// TODO Auto-generated method stub
if(packet instanceof TCPPacket) { //If the packet is TCP
String[] dataArray = tcp2String(packet); //Call this method
}
else if(packet instanceof UDPPacket) {
String[] dataArray = UDP2String(packet);
}
} | 2 |
public static int stringToInt(String str){
int agentType=0;
if(str.matches(".*R.*"))
agentType = agentType+100;
if(str.matches(".*B.*"))
agentType = agentType+10;
if(str.matches(".*P.*"))
agentType++;
return agentType;
} | 3 |
int readCorner2(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 3, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 2, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRo... | 8 |
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 Class defineClass(byte[] bytes) {
try {
Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class /*name*/, byte[].class /*b*/, int.class /*off*/, int.class /*len*/);
defineClass.setAccessible(true);
return (Class) defineClass.invoke(classLoader, null, bytes, 0, ... | 3 |
private static MavenJarFile downloadAndUnzipJarForWindows(MavenJarFile mavenJarFile, URL jarRepository, FileDAO fileDAO, boolean cleanupZipFile) throws MalformedURLException, IOException, XMLStreamException {
MavenJarFile newMavenJar;
URL archiveURL = WebDAO.getUrlOfZippedVersion(jarRepository, ".zip", ... | 3 |
private void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
// magic number for Windows, 64Mb - 32Kb)
int maxCount = (64 * 1024 * 1024) ... | 4 |
@Override
public void prevChannel() {
if (memorizedChannels.isEmpty()) {
super.prevChannel();
return;
}
int idx = memorizedChannels.indexOf(channel);
int nextIndex = 0;
if (idx == 0) {
nextIndex = memorizedChannels.size() - 1;
} e... | 3 |
private void addPackages(CoberturaData data, Document doc, Element packages) {
for (String path : data.getPackageMap().keySet()) {
Element packageElement = doc.createElement("package");
packages.appendChild(packageElement);
packageElement.setAttribute("name", path);
... | 2 |
public final TWS_SCHEDULESParser.calendarDefinition_return calendarDefinition() throws RecognitionException {
TWS_SCHEDULESParser.calendarDefinition_return retval = new TWS_SCHEDULESParser.calendarDefinition_return();
retval.start = input.LT(1);
Object root_0 = null;
Token ID96=null;
Token STRING_LITERAL97=... | 9 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// get the size of the matrix to rotate.
String matrixSizeLine = in.nextLine();
Scanner matrixSize = new Scanner(matrixSizeLine);
int width = matrixSize.nextInt();
int height = matrixSize.nextInt();
// Keep readi... | 8 |
private void processAddToDeck(MouseEvent e) {
if (!game.hasDealt()) {
activeMove.cardReleased(0, CardMoveImpl.MOVE_TYPE_TO.TO_DECK);
processMoveResult(activeMove.makeMove(game, this), activeMove);
System.out.println("Add to Deck" + activeMove);
}
} | 1 |
public static double asin(double a){
if(a<-1.0D && a>1.0D) throw new IllegalArgumentException("Fmath.asin argument (" + a + ") must be >= -1.0 and <= 1.0");
return Math.asin(a);
} | 2 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result + id;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
} | 2 |
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.