text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public String getLeiterBerechtigungBezeichnung(){
Berechtigung berechtigung = dbZugriff.getBerechtigungzuLeitername(Leitername);
if(berechtigung!=null)return berechtigung.getBerechtigungbez();
else return "Keine Berechtigung";
} | 1 |
@Id
@Column(name = "PCA_POS_ID")
public Integer getPcaPosId() {
return pcaPosId;
} | 0 |
public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
if (args.length == 2) StdRandom.setSeed(Long.parseLong(args[1]));
double[] t = { .5, .3, .1, .1 };
System.out.println("seed = " + StdRandom.getSeed());
for (int i = 0; i < N; i++) {
System.ou... | 3 |
public String getString(String key) {
try {
if(hasKey(key))
return ((NBTReturnable<String>) get(key)).getValue();
return "";
} catch (ClassCastException e) {
return "";
}
} | 2 |
public boolean gEquals(Object other) {
if (other instanceof Recipe) {
Recipe that = (Recipe) other;
if (that.size() == this.size()) {
RNode k = that.head;
while (k != null) {
if (!bevatGeq(k.getElement())) {
return false;
}
k = k.getNext();
}
return true;
}
}
return ... | 4 |
@Override
protected void process(List<String[][]> chunks) {
int processed = 0;
while(processed < players.length) {
RemotePlayer remotePlayer = playerHandler.createRemotePlayer(100, 0, players[processed][0]);
remotePlayer.spawn(0, 0, 100, 0, parent, mapFrame);
processed++;
}
} | 1 |
public void addArrayEntries(ConnectionWrapper cw, Long arrayId,
Object array, DelayedInsertionBuffer delayBuffer)
throws SQLException
{
ProtectionManager protectionManager = adapter.getPersist()
.getProtectionManager();
Class<?> compType = array.getClass().getComponentType();
// the table name for the ... | 6 |
public int[] fastCarMove(int x, int y, Direction direction, Car movingCar) {
//Precondition: direction != null; movingCar != null; x & y are coordinates on the map
//Postcondition: returns int[] with 2 elements which has coordinates on the map
int returnX, returnY;
int[] tmpInt = direction.moveStraight();
... | 4 |
public static WritableRaster RGBToCIEXYZ(Raster src,
int[] srcComponentSize,
WritableRaster dest,
int[] destComponentSize) {
checkParameters(src, srcComponentSize, dest,destCom... | 9 |
private void configUnique(Method method) {
Unique unique = method.getAnnotation(Unique.class);
Class<?> returnType = method.getReturnType();
if (unique != null || !ClassHelper.isTypeList(returnType)) {
isUnique = true;
} else {
isUnique = false;
}
} | 3 |
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(final PlayerChatEvent paramPlayerChatEvent) {
final Player localPlayer = paramPlayerChatEvent.getPlayer();
for (final IRCChannel c : MonsterIRC.getChannels()) {
if (c.getChatType() == ChatType.TOWNYCHAT) {
... | 6 |
private void gameOver() {
switch (isGameOver()){
case 0:
break;
case -1:
for (Player p: players){
if (p.getHero().getTeam().getSide() == Team.Side.RIGHT){
endGame(p.getHero().getTeam());
return;
}
}
break;
case 1:
for (Player p: players){
if (p.getHero().getTeam().getSide() ... | 7 |
public static String buildMinimalLom(String englishTitle, String frenchTitle, String metadataLang, String location) {
Calendar cal = Calendar.getInstance();
String now = cal.get(Calendar.YEAR) + "-";
now += StringUtil.insertLeading( '0', 2, cal.get(Calendar.MONTH) + 1 + "" );
now += "-";... | 4 |
public void setBytes(byte[] value, int offset){
for (int i=0; i<value.length; i++){
bytes[offset++] = value[i];
}
} | 1 |
public static ITypeResolver arithmType(Type lh, Type rh) {
int cmp = rh.compare(lh);
if (cmp > 0) {
return new PlainOldTypeResolver(rh);
} else if (cmp == 0) {
if (rh instanceof PrimType) {
return new PlainOldTypeResolver(rh);
}
return new PlainOldTypeResolver(lh);
} else if (cmp == -1) {
r... | 4 |
String ajaxCall(String dest, BufferedReader sin) {
Socket client = null;
PrintWriter out = null;
BufferedReader in = null;
// Get Ajax call
Scanner scan = new Scanner(sin);
scan.useDelimiter("\n\n");
String all = scan.next();
//res.log("Sending to " + dest + ": '" + all +"'");
// clean up de... | 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 |
void addConnection(Object from, Object to) {
List<Object> tos = graph.get(from);
if (tos == null) {
tos = new ArrayList<Object>();
graph.put(from, tos);
}
tos.add(to);
} | 1 |
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[61];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 71; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... | 9 |
public void setImgPath_AccessSym(Path img) {
this.imgAccessSym = handleImage(img, UIResNumbers.ACCESSSYMBOL.getNum());
if (this.imgAccessSym == null) {
this.imgAccessSym = UIDefaultImagePaths.ACCESSSYMBOL.getPath();
deleteImage(UIResNumbers.ACCESSSYMBOL.getNum());
}
... | 1 |
public static String scrambleText(String Text) {
StringBuilder Scrambled = new StringBuilder();
if (Text.contains(" ")) {
String[] Words = Text.split(" ");
for (String word : Words) {
ArrayList<Character> chars = new ArrayList<Character>(word.length());
for (char c : word.toCharArray()) {
chars.a... | 6 |
public Room getDeepestRoom() {
int rId = 0;
int depth = 0;
for (Room r : mapRooms) {
if (r.getDepth() > depth && !r.isCorridor()) {
depth = r.getDepth();
rId = r.getId();
}
}
return mapRooms.get(rId);
} | 3 |
public boolean allowRun(HttpServletRequest request) {
if(request.getSession().getAttribute("sessionInStr") == null || request.getParameterValues("moveDirection") == null
|| request.getParameterValues("curState") == null || request.getParameterValues("readSymb") == null
|| request... | 6 |
protected void drawTiles() {
showedTiles = new BufferedImage(panelWidth, panelHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) showedTiles.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CO... | 7 |
public void setName(String name) {
this.name = name;
} | 0 |
public void getMovesFromWordPositional ( Word WORD, int x, int y,
Vector<Move> moves, boolean isUpDown, int xOrg, int yOrg ) {
boolean has = this.checkWord ( WORD, 0, x, y, isUpDown,
new Vector<Character> ( this.hand ), this.hand.size ( ) ) ;
if ( has ) {
has &= this.checkIntercept ( x, y,... | 5 |
public void noLongerAt(SharingPeer peer) {
this.seen--;
} | 0 |
public static void removeSelectedTray(Tray tray) {
if (tray == null) return;
if (StorageUnitDisplayPanel.selectedTrays.remove(tray)) StorageUnitDisplayPanel
.triggerTraySelectionChanged();
} | 2 |
private boolean isValidInput(final String s) {
//in this case - everything is valid
return true;
} | 0 |
public Object getValueAt(int row, int col) {
int count=0;
for(Map.Entry<K,Cache.Value<ReplCache.Value<V>>> entry: map.entrySet()) {
if(count++ >= row) {
K key=entry.getKey();
Cache.Value<ReplCache.Value<V>> val=entry.getValue();
... | 7 |
public int largestRectangleArea2(int[] height) {
// Start typing your Java solution below
// DO NOT write main() function
if (height == null || height.length == 0)
return 0;
int max = 0, tmp;
Stack<Integer> stack = new Stack<Integer>();
for (int i = 0; i < height.length; i++) {
if (!stack.isEmpty() &... | 9 |
public void test_add_RP_int_intarray_int() {
int[] values = new int[] {10, 20, 30, 40};
int[] expected = new int[] {10, 20, 30, 40};
BaseDateTimeField field = new MockStandardBaseDateTimeField();
int[] result = field.add(new TimeOfDay(), 2, values, 0);
assertEquals(true, Arrays.e... | 2 |
public int compareTo(DBType t) {
StringType st = null;
if (t instanceof StringType) {
st = (StringType) t;
} else {
return -1;
}
String i = st.get();
if (i == null && value == null) {
return 0;
} else if (i != null && value == null) {
return -1;
} else if (i == null && value != null) {
... | 9 |
public static Node getNode(Node node, ArrayList<Node> list) {
for (Node m : list) {
if(m.equals(node)) {
return m;
}
}
return null;
} | 2 |
public double getMean() {
if (total_size == 0) return Double.NaN;
double mean = 0.0;
if (type == Integer.class) {
for (int i = 0; i < total_size; i++) {
mean += ((int[])vals)[i];
}
mean = mean / (double)total_size;
} else {
... | 4 |
@Test
public void adicionarDoisClientesComDependentesIquais() throws ExceptionGerentePessoa {
Cliente c = setarCliente("João", "000.000.000-00");
Cliente c2 = setarCliente("Carlos","000.000.000-00");
faixada.adicionar(c);
faixada.adicionar(c2);
Assert.assertTrue("Era para ter adicionado os dependentes dos cl... | 1 |
@SuppressWarnings("unused")
public void move(){
if(!motionLock){
double stepX;
double stepY;
double angle;
stepX = new Random().nextInt(3);
stepY = new Random().nextInt(3);
while(!(posX + stepX > 0) &&
!(posX + stepX < settings.screenWidth - 40) &&
!(posY + stepY > 0) &&
!(posY + ste... | 5 |
@RequestMapping(value = {"/SucursalBancaria/{nombreSucursal}"}, method = RequestMethod.GET)
public void readByName(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("nombreSucursal") String nombreSucursal) {
ObjectMapper jackson = new ObjectMapper();
String json ... | 2 |
public static void updateLearning(int action){
try { // Try to read values from the file
BufferedReader reader = new BufferedReader(new FileReader("learn.txt"));
String line = null;
line = reader.readLine();
int planetsL = Integer.valueOf(line);
line = reader.readLine();
int shipsL = Integer.valueO... | 7 |
static int countCompress(String s) {
char[] charArray = s.toCharArray();
int count = 0;
int length = 0;
char currentChar = '\0';
for (char ch: charArray) {
if (ch == currentChar) {
count += 1;
} else {
if (currentChar != '\0... | 3 |
public static GeneralValidator isGreaterThan() {
return GREATER_THAN_VALIDATOR;
} | 0 |
public boolean addShopItem(int itemID, int amount) {
boolean Added = false;
if (amount <= 0) {
return false;
}
if (Item.itemIsNote[itemID] == true) {
itemID = GetUnnotedItem(itemID);
}
for (int i = 0; i < server.shopHandler.ShopItems.length; i++) {
if ((server.shopHandler.ShopItems[MyShopID][i] - 1... | 7 |
public double CircleCombine(Instances train,Classifier[] cfsArray,List<Integer>[] classifyResult,List<Double> correctRateArray,double initCorrectRate, double interval,List<Double> currentResult,List<Integer> ClassifierNo,String CCAlgorithm)throws Exception{
Logger logger = Logger.getLogger(SeletiveAlgorithm.class);
... | 9 |
public void start() {
new Thread(new Runnable() {
public void run() {
while(true) {
try {
if(isPaused) {
Thread.sleep(500L);
continue;
}
double loadAvg = loadManager.getCurrentLoad();
// Check the thread cap
int maxThreads = CronFireSettings.getSet... | 9 |
public void reformTransform(Rectangle viewBounds) {
//completely unrelated
// MouseListener[] k;
// System.out.println((k = this.getListeners(MouseListener.class)).length);
// for (int i = 0; i < k.length; i++)
// System.out.println(k[i]);
//end completely unrelated
transformNe... | 3 |
private void initData() {
//System.out.println("33333333");
DataCount dc = new DataCount();
dc.init(user_name);
timemap = dc.getdata();
//排序
num = 0;
Iterator<String> iter = timemap.keySet().iterator();
while(iter.hasNext()) {
//System.out.print... | 6 |
@Override
public void tick(float dt) {
timeSinceLastShot += dt;
if(!shots.isEmpty()) {
ListIterator it = shots.listIterator();
while(it.hasNext()) {
Projectile shot = (Projectile)it.next();
if(shot.isDestroyed()) {
it.remove... | 5 |
private void addResourcePanel(final String username) {
resourcePanel = new JPanel();
resourcePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
resourcePanel.setBorder(new TitledBorder("对应权限"));
resourcePanel.setPreferredSize(new Dimension(800, 150));
ResourceService resourceServ... | 5 |
@Override
public Iterator<Integer> iterator(){
return new Iterator<Integer>(){
private int currentColor = 0;
@Override
public boolean hasNext()
{
return currentColor <= maxVal;
}
@Override
public Integer n... | 0 |
private static boolean isValidDiscount(Integer discount) {
return discount != null && discount >= DISCOUNT_MIN && discount <= DISCOUNT_MAX;
} | 2 |
private void applyComments(String filename, Map<String,List<Comment>> comments) throws IOException
{
// read new file's text
StringBuffer buffer = this.getNewFileSource(filename);
// create output file
File outputFile = new File(this._outDir + filename);
// make sure our file's directory exists
outputFil... | 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... | 4 |
public ComingRequestChatHandler(Socket socket, String userName) {
// TODO Auto-generated constructor stub
file = null;
comingRequestSocket = socket;
myUserName = userName;
} | 0 |
@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 Adresswechsel)) {
return false;
}
Adresswechsel other = (Adresswechsel) object;
if ((this.id == null && other.i... | 5 |
public double getAllPointScore(Board currentBoard, int playerColor, double playerCautious ) {
if (! Board.legitPlayerColor(playerColor)) {
throw new IllegalArgumentException("bad color '" + playerColor + "'");
}
double score = 0;
for (int i=1; i<=Board.howManyPoints; i... | 7 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... | 8 |
public static void main (String[] args) throws IOException {
TorrentMetaInfo tmi = readExampleFile();
TorrentInfoSection tis = tmi.getInfoSection();
System.out.printf("Comment: %s%n", tmi.getComment());
System.out.printf("Created By: %s%n", tmi.getCreatedBy());
System.out.printf... | 2 |
public boolean access(long addr, long[] wb_tag, boolean isLoad) {
// FIX ME for question 8
accessTime++;
long addr_tag = getTag(addr);
int addr_index = getIndex(addr);
long addr_block = getBlockAddress(addr);
boolean[] hit = new boolean[this.associativity];
int touchedWay = -1;
boolean hit_f = false... | 9 |
public void saveAsJpg(String fileName){
BufferedImage img = new BufferedImage(drawPanel.getWidth(),drawPanel.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D g = img.createGraphics();
super.paintComponent(g);
unSelect();
for(TextBox t:shapeList){
t.draw(g);
}
try{
ImageIO.write(img, "JPG... | 2 |
public void processFiles() throws IOException {
// Open the destination File
PrintWriter writer = new PrintWriter(dest, "UTF-8");
for (String f : files) {
// Open a print reader and begin processing
BufferedReader br = new BufferedReader(new FileReader(f));
/... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TraderImpl)) {
return false;
}
TraderImpl other = (TraderImpl) obj;
if (login == null) {
if (other.login != null) {
return false;
}
} else ... | 6 |
private boolean isPotentialCallbackMethod(SootClass currentClass, String methodName)
{
boolean existCurrentMethod = false;
List<SootMethod> currentMethods = currentClass.getMethods();
for (SootMethod method : currentMethods)
{
if (method.getName().equals(methodName))
{
existCurrentMethod = t... | 9 |
@Override
public String toString() {
switch(this) {
case Team1Victory: return "Team 1 has won on Arena %arena%";
case Team2Victory: return "Team 2 has won on Arena %arena%";
case TimeLimitReached: return "Time limit has been reached on Arena %arena%";
case NoPlayersLeft: return "Arena %arena% has ended... | 4 |
public void execute(Miner miner){
//if miner is not fatigued start to dig for nuggets again.
if (!miner.fatigued())
{
System.out.println(miner.getName() + " What a God darn fantastic nap! Time to find more gold");
miner.changeState(EnterMineAndDigForNugget.getSingleton());
}
els... | 1 |
static public ArrayList SplitConfig(String comment, String splitstring) {
String temp = "";
String[] array = comment.split(splitstring);
ArrayList list = new ArrayList();
for(int i=0; i<array.length; i++) {
if (array[i].length() > 0) { /* Exclude empty rows */
... | 5 |
public List<Partner> getPartnerList() {
return partnerList;
} | 0 |
@Override
public void play(String audioType, String fileName) {
// Java 8 can use Strings in switch.
switch (audioType) {
case "Mp3":
System.out.println("Playing Mp3 File :" + fileName);
break;
case "VLC":
case "Mp4":
MediaAdapter adapter = new MediaAdapter(audioType);
adapter.play(audioType, fi... | 3 |
public void insert(E e) {
DoublyLinkedNode n = new DoublyLinkedNode();
n.setKey(e);
if (head == null) {
head = n;
tail = n;
} else {
if (head != null) {
head.setPred(n);
n.setSucc(head);
head = n;
... | 2 |
public static String format(final long millis) {
final StringBuilder sb = new StringBuilder();
final long totalseconds = millis / 1000L;
final long totalminutes = totalseconds / 60L;
final long totalhours = totalminutes / 60L;
final int seconds = (int) totalseconds % 60;
final int minutes = (int) totalminut... | 5 |
protected void changeNeuronWeight(int neuronNumber, double[] vector, int iteration){
double[] weightList = networkModel.getNeuron(neuronNumber).getWeight();
int weightNumber = weightList.length;
double weight;
if(showComments){
String vectorText="[";
for(i... | 9 |
public static int getStandardWidth() {
if (width == -1) {
int x = Launcher.getFrameBounds().width;
x -= (x % GameModel.getUnit());
width = x;
}
return width;
} | 1 |
public void actionPerformed(ActionEvent arg0)
{
/**
* Vérification du nom des joueurs
*/
//obtention des noms des joueurs
ArrayList<String> joueursNames = new ArrayList<String>(4);
joueursNames.clear();
joueursNames.add(joueur1.getText());
joueursNames.add(joueur2.getText());
joueursNames.add(jou... | 9 |
public void init(Map attributes) throws InvalidKeyException {
if (wired != null) {
throw new IllegalStateException();
}
Direction flow = (Direction) attributes.get(DIRECTION);
if (flow == null) {
flow = Direction.FORWARD;
}
int optimalSize = 0;
for (Iterator ... | 5 |
@Override
public String toString() {
String returnString = "RETURN";
if (functionName != null) {
int indexOfLessThan = functionName.indexOf("<");
String truncatedFunctionName = functionName;
if (indexOfLessThan != -1) {
truncatedFunctionName = func... | 2 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
fcAttach = new javax.swing.JFileChooser();
fcContainer = new javax.swing.JFileChooser();
btngrpContainer = new javax.swing.ButtonGroup... | 2 |
@Override
public ByteBuf serialize(O_5x_AbstractDataType ucpOperation) {
ByteBuf bb = Unpooled.buffer();
Serialization.serializeString(bb, ucpOperation.getAdc());
Serialization.serializeString(bb, ucpOperation.getOadc());
Serialization.serializeString(bb, ucpOperation.getAc());
Serialization.serializeChar... | 4 |
public void setObservacionCollection(Collection<Observacion> observacionCollection) {
this.observacionCollection = observacionCollection;
} | 0 |
public void zoomActual()
{
mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(1)
: new mxPoint();
graph.getView()
.scaleAndTranslate(1, translate.getX(), translate.getY());
if (isPageVisible())
{
// Causes two repaints, see zoomTo for more details
SwingUtilities.invokeLater(new R... | 7 |
private void setPlayerShips(String playerName) {
Scanner input = new Scanner(System.in);
int iLocation = 0;
int jLocation = 0;
Location locationObject = new Location();
String[][] listOfSpots = locationObject.makeStringListOfSpots();
System.out.println(playerName + ", e... | 7 |
public static void mkdir(String mkdirName)
{
try
{
File dirFile = new File(mkdirName); //mkdirName: path of folder
boolean bFile = dirFile.exists();
if( bFile == true )
{
System.out.println("The folder exists.");
}
... | 3 |
private void replaceForRemove(Node oldNode, Node newNode) {
// удалить newNode
removeNode(newNode);
// удалить oldNode, и вместо него поставить newNode
if (root == oldNode) {
root = newNode;
} else {
Node parent = oldNode.getParent();
if (parent.getLeftChild() == oldNode) {
... | 7 |
public static void main(String[] args) {
try {
/* Returns the Class object associated with the class or
* interface with the given string name.
*/
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("MySQL JDBC Driver not found.");
e.printStackTrac... | 5 |
private static void createGraph() {
Pattern p = Pattern.compile( ",| |\n|\r" );
try {
Scanner scan = new Scanner(new FileReader(_fileName));
scan.useDelimiter(p);
int index = 0;
while( scan.hasNextLine() ) {
int ID = scan.nextInt();
... | 5 |
@SuppressWarnings("ConstantConditions")
@Test
public void testOTUReducedRedundancyTest() {
File otuDir = new File("/home/alext/Documents/tuit/OTU Seq90/Seqs");
File tmpDir = new File("/home/alext/Downloads/tmp");
File executable = new File("/usr/local/bin/clustalw2");
File[] otu... | 8 |
public String getConnectionsInfo(){
String str = "Conditions:";
for(String id: conditions){
str += id+" ";
}
str += "\n";
for(int i=0;i<connections.size();i++){
Connection conn = connections.get(i);
str += "Z"+String.valueOf(conn.from... | 5 |
public static long getJailTime(String playerName){
long bantime = 0;
if(isJailed(playerName)){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'");
// This loop checks all bans o... | 4 |
public boolean meets() {
final String curTitle = getTitle();
return isOpen()
&& (getTitle() == null || curTitle != null
&& (curTitle.contains(getTitle()) || getTitle().contains(curTitle)))
&& hasOption(text);
} | 5 |
Transaction openWrite(Transaction me) {
boolean cacheHit = false; // already open for read?
// not in a transaction
if (me == null) { // restore object if latest writer aborted
if (writer.isAborted()) {
rVersion.recover();
writer = Transaction.COMMITTED;
}
return null;
... | 8 |
@Override
public String strip(String s) throws Exception {
final int length = s.length();
if (oldChars.length < length) {
oldChars = new char[length];
}
s.getChars(0, length, oldChars, 0);
int newLen = 0;
for (int j = 0; j < length; j++) {
char... | 4 |
public void welcome() {
while (true) {
Socket s = null;
try {
s = ss.accept();
System.out.println("Port:" + s.getPort());
System.out.println("Address:" + s.getInetAddress());
System.out.println("LocalPort:" + s.getLocalPort());
System.out.println("LocalAddress:" +
s.getLocalAddress());... | 4 |
public int columnsCount()
{
if(this.map[0] != null)
return this.map[0].length;
else
return 0;
} | 1 |
private static int[] getPositivesAndNegatives(String distinctValue,
String attribute, ArrayList<HashMap<String, String>> examples) {
int[] pn = new int[2];
for (HashMap<String, String> example : examples) {
if (attribute == null
|| example.get(attribute).equals(distinctValue)) {
if (example.get("Goal... | 4 |
private static boolean checkLength (int c) {
char[] charsC = ("" + c).toCharArray();
if (charsC.length == 4) return true;
else return false;
} | 1 |
public boolean InRange(double px, double py, int dir, double dx, double dy) {
// System.out.println("InRange"+px+", "+py+" dir "+dir+" dx "+dx+" dy"+dy);
if (dir == 2)
{
if (Math.abs(coord[0] - px) < dx && Math.abs(coord[1] - py) < dy)
return true;
}
... | 8 |
public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException {
super.initialize(flowChartinstance, chartItemSpecification);
for (String key : chartItemSpecification.getChartItemAttributes().keySet()) {
if (key.equals("id")) {
idName... | 9 |
public void setMove(int move) {
//If we can't move then we souldn't change the move
if(!canMove)
return;
//For we do not update their move, we should perform a check
if(this.move == MOVE_DOWN){
switch(move){
case MOVE_LEFT+MOVE_UP:
this.move += MOVE_LEFT;
break;
case MOVE_RIGHT+MOVE_UP:
... | 8 |
protected int getDaysOfMonth(int year, int month) {
cal.set(year, month - 1, 1);
cal.roll(Calendar.DATE, -1);
return cal.get(Calendar.DATE);
} | 0 |
public boolean isConnected() {
for (int i=0; i<this.getInput().length; i++)
if (this.getInput()[i]==null) {
return false;
}
for (int i=0; i<this.getOutput().length; i++)
if (this.getOutput()[i]==null) {
return false;
}
... | 4 |
public void draw_frame_rate(Graphics2D g2) {
if (( XHSIStatus.status.equals(XHSIStatus.STATUS_RECEIVING) ) || ( XHSIStatus.status.equals(XHSIStatus.STATUS_PLAYING_RECORDING) )) {
g2.setColor(Color.BLACK);
g2.setFont(gc.font_statusbar);
// draw scale
g2.drawStrin... | 7 |
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.