text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Boolean selectTests(Connection con, Triple t){
try{
ResultSet rs = con.select("SELECT ?s ?p ?o FROM <http://example.com> WHERE {?s ?p ?o} LIMIT 1");
int i =0;
while(rs.next()){
if(! rs.getObject(1).toString().equals(t.getSubject().toString()))
return false;
if(! rs.getObject(2).toString()... | 5 |
public void collectCallbackMethodsIncremental() {
Transform transform = new Transform("wjtp.ajc", new SceneTransformer() {
protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes") Map options) {
// Process the worklist from last time
System.out.println("Running incremental callback ... | 2 |
@Override
public void caseAThisHexp(AThisHexp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(This");
inAThisHexp(node);
if(node.getThis() != null)
{
node.getThis().apply(this);
}
outAThisHexp(node);... | 3 |
public void findIndexUsageForPair(TablePairActivity tablePair) {
for (Query query : queries) {
List<String> queryRelations = query.getRelations();
Set<QueryFilter> queryFilters = query.getSelections();
String tableA = tablePair.getNameOfTableA();
String tableB = tablePair.getNameOfTableB();
if (table... | 8 |
public static void main(String args[]) throws IOException {
//Input server check
System.out.println("Is this the server?");
Scanner sysIn = new Scanner(System.in);
String inToken = sysIn.nextLine();
if(inToken.equalsIgnoreCase("yes")) {
isServer = true;
}
else {
isServer = false;
}
try {
//Op... | 9 |
@Override
public boolean add(E e) {
setIn = new Node(e);
Node previous = null;
if(isEmpty()){
root = setIn;
ant++;
return true;
}
current = root;
while(current != null){
if(setIn.object.compareTo(current.object)<0){
previous = current;
current = current.right;
}else if(setIn.object.c... | 7 |
public static double[][] getInverse(double[][] A){
if(A.length != A[0].length)
return null;
if(getDet(A) == 0)
return null;
double T[][] = new double[A.length][A.length*2];
double I[][] = generateIdentity(A.length);
for(int i = 0; i<A.length; i++){
for(int j = A.length; j<T[0].length; j++){
T[i][... | 8 |
public static String trimFront(String text, String match, int numToTrim) {
int substringStart = 0;
for (int i = 0; i < numToTrim; i++) {
if (text.startsWith(match, substringStart)) {
substringStart += match.length();
}
}
return text.substring(substringStart, text.length());
} | 2 |
protected void quickSort(int low, int high, List<Player> players) {
int i = low;
int j = high;
Hand pivot = players.get(low + (high - low) / 2).getHands().get(0);
while (i <= j) {
while (players.get(i).getHands().get(0).compareTo(pivot) < 0)
i++;
while (players.get(j).getHands().get(0).compareTo(piv... | 6 |
private void generateLabelledDescription() throws Exception {
Description originalDescription = super.getDescription();
labelledDescription = Description
.createSuiteDescription(originalDescription.getDisplayName());
ArrayList<Description> childDescriptions = originalDescription
... | 3 |
public static void disposeall(GL gl) {
Collection<Integer> dc;
synchronized (disposed) {
dc = disposed.get(gl);
if (dc == null)
return;
}
synchronized (dc) {
if (dc.isEmpty())
return;
int[] da = new int[dc.size()];
int i = 0;
for (int id : dc)
da[i++] = id;
dc.clear();
gl.glD... | 3 |
public ListNode reverse(ListNode head) {
if (head == null || head.next == null)
return head;
ListNode p = head.next;
head.next = null;
while (p != null) {
ListNode nextP = p.next;
p.next = head;
head = p;
p = nextP;
}
return head;
} | 3 |
private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 4);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 4);
}
switch(curChar)
{
case 48:
return jjMoveStringLiteralD... | 8 |
public int fight() {
/*int damage = random.nextInt(maxDmg - (minDmg + 1)) + minDmg;
if(random.nextInt(100) < this.luck)
{
System.out.println("Critical Attack!");
return (int) damage * 2;
}*/
return (int) this.strength;
} | 0 |
private void createFictionalState() {
State fictionalState = new State(states.length, false);
for (Character ch : alphavet) {
fictionalState.addNextState(ch, fictionalState);
}
boolean flag = alphavet.contains('e');
if (flag) {
alphavet.remove('e');
... | 6 |
public int getDistance() {
// check preconditions
int m = s1.length();
int n = s2.length();
if (m == 0) {
return n; // some simple heuristics
} else if (n == 0) {
return m; // some simple heuristics
} else if (m > n) {
String tem... | 7 |
private void conditional() throws CompilationException {
binOP(0);
if (type==35) { // '?'
int ecol=ct_column;
nextToken();
int stackSizeBeforeBranch=paramOPs.size();
conditional();
consumeT(36); // ':'
int stackSizeAfterFirstBranch=paramOPs.size();
condit... | 3 |
private void testAbstractMethods(ByteMatcher matcher) {
// test methods from abstract superclass
assertEquals("length is one", 1, matcher.length());
assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0));
try {
matcher.getMatcherForPositio... | 9 |
public void checkBanks() {
try {
File dir = new File("characters");
if(dir.exists()) {
String read;
File files[] = dir.listFiles();
for (int j = 0; j < files.length; j++) {
File loaded = files[j];
if (loaded.getName().endsWith(".txt")) {
Scanner s = new Scanner (loaded);
int c... | 9 |
public boolean requestEnter(Story st){
boolean isTrueStory = building.getElevator().getCurrentStory().equals(dispatchStory);
boolean isBoading = building.getElevator().getAction().equals(Actions.BOARDING);
if (gui.isAborted()){
setTransportationState(TransportationState.ABORTED);
return true;
} el... | 4 |
public boolean nemfoglalt()
{
if(sajat[hovaakar1][hovaakar2]==0)
return true;
logger.info("A lépés foglalt mezőre lépne!");
return false;
} | 1 |
final void init() throws IOException {
receivingSocket = new MulticastSocket(4446);
multicastAddre = InetAddress.getByName("230.0.0.1");
receivingSocket.joinGroup(multicastAddre);
receiverThread = new MulticastReceiverThread();
sendSocket = new MulticastSocket(4446);
... | 0 |
@Override
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir + "BeachBetrayal.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) { // cannot attack
File imageFile = new F... | 8 |
public void update(GameContainer gcan, StateBasedGame state, int delta) throws SlickException
{
mx = Mouse.getX();
my = 720 - Mouse.getY();
Point t = mouseToIso();
isox = (int) t.getY();
isoy = (int) t.getX();
a.update();
b.update();
c.update();
d.update();
if(a.activated())
{
Session... | 6 |
static final void method1252(int i, int i_2_, int i_3_, int i_4_, int i_5_,
int i_6_, int i_7_, byte i_8_, int i_9_) {
anInt2124++;
if (!Class320.method2547(i_2_, (byte) 84)) {
if (i_4_ == -1) {
for (int i_10_ = 0; (i_10_ ^ 0xffffffff) > -101; i_10_++)
Class152.aBooleanArray2076[i_10_] = true;
... | 9 |
public void setAgentColor(Color c) {
agentColor = c;
} | 0 |
public SimpleMultiReplacementFileContentsHandler(Vector matches, Vector replacements, String lineEnding) {
super(lineEnding);
setMatches(matches);
setReplacements(replacements);
} | 0 |
public void keyPressed(KeyEvent e) {
if (e.getKeyModifiersText(e.getModifiers()).equals("Alt")) {
int arg = 0;
try {
arg = Integer.parseInt(e.getKeyText(e.getKeyCode()));
} catch (NumberFormatException ex) {
return;
}
switch (arg) {
case 1: //settlement
gameLogic._... | 6 |
public List<String> parse(final String line) {
final List<String> list = new ArrayList<>();
final Matcher m = csvRE.matcher(line);
// For each field
while (m.find()) {
String match = m.group();
if (match == null) {
break;
}
if (match.endsWith(",")) { // trim trailing ,
match = match.substrin... | 6 |
private void doClear(button[][] mineButtons, int x, int y) throws Exception {
System.out.println("x:" + x + " y:" + y);
if (x < 0 || x >= 10 || y < 0 || y >= 10) {
return;
}
button currButton = mineButtons[x][y];
if (!currButton.isEnabled()) {
return;
}
currButton.setBackground(Color.lightGray);
... | 9 |
private void internalDecompose(CharSequence source, StringBuffer target) {
StringBuffer buffer = new StringBuffer(8);
boolean canonical = (form & COMPATIBILITY_MASK) == 0;
int ch32;
//for (int i = 0; i < source.length(); i += (ch32<65536 ? 1 : 2)) {
for (int i = 0; i < source.len... | 9 |
public static boolean isValid(String IP){
IP = IP.trim();
if(IP.startsWith(".") || IP.endsWith(".")){
return false;
}
String[] ipArr = IP.split("\\.");
if(ipArr.length == 4){
for(String str : ipArr){
if(str.length() >= 0 && str.length() <=3){
try
{
int val= Integer.pa... | 9 |
public URL getCodeBase() {
if (Signlink.mainapp != null) {
return Signlink.mainapp.getCodeBase();
}
try {
if (super.frame != null) {
return new URL("http://127.0.0.1:" + (80 + Client.portOff));
// return new URL("http://ss-pk.no-ip.biz:" + ... | 3 |
public Item getItem(){
Item item;
if (originalItem==null)
item=new Item();
else item=originalItem;
item.setName(nameTextField.getText());
item.setDescription(descriptionTextField.getText());
item.setPrice(Integer.parseInt(priceTextField.getText()));
item.setQuantity(Integer.parseInt(quantityTextField.ge... | 1 |
private static void displayReviewVideo(BufferedReader reader, VideoStore videoStore) {
try {
System.out.println("Please enter the title of the video you want review:");
String isbn = getISBNFromTitle(reader, videoStore, reader.readLine());
if (videoStore.getOwnReviews(isbn, ... | 4 |
@Override
public void registerEvent(Class<? extends Event> clazz) {
} | 1 |
public String getEmail() {
return email;
} | 0 |
void remove()
{
if ( left == null || right == null )
{
if ( this.left != null )
this.left.right = this.right;
if ( this.right != null )
this.right.left = this.left;
if ( this == parent.diagonals )
parent.diagonals = ... | 5 |
public static String trimSlashes(String s)
{
String temp = s;
if (temp.charAt(0) == DELIMITER.charAt(0)) temp = temp.substring(1);
if (temp.charAt(temp.length() - 1) == DELIMITER.charAt(0)) temp = temp.substring(0, temp.length() - 1);
return temp;
} | 2 |
@Override
public Node beforeDecode(mxCodec dec, Node node, Object into)
{
if (into instanceof mxChildChange)
{
mxChildChange change = (mxChildChange) into;
if (node.getFirstChild() != null
&& node.getFirstChild().getNodeType() == Node.ELEMENT_NODE)
{
// Makes sure the original node isn't modifi... | 6 |
@Override
public Result run() {
Result result = null;
try {
Equals<Double> criterion = this.getCriterion();
Function<Double, Double> value = this.getFunction();
double goalValue = this.getGoalValue();
int maxIter = this.getMaximumIterations();
... | 8 |
public byte[] toByteArray(){
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
try {
out = new ObjectOutputStream(bos);
out.writeObject(this);
return bos.toByteArray();
}catch(Exception e){e.printStackTrace(); return null;}
finally {
try {if (out != null) {out.c... | 4 |
@Override
public void process(OurSim ourSim) {
Peer peer = ourSim.getGrid().getObject(peerId);
if (!peer.isUp()) {
return;
}
PeerRequest request = peer.getRequest(requestSpec.getId());
if (request == null && !repetition) {
request = new PeerRequest(requestSpec,
requestSpec.getBrokerId())... | 8 |
private Tag findInSuggestedTags(String value) {
if (suggestedTags != null) {
for (Tag tag : suggestedTags) {
if (tag.getTag().equalsIgnoreCase(value)) {
return tag;
}
}
}
return null;
} | 3 |
public String createPortOutput(int port, boolean resolve) {
String output = "";
if (port == 0)
return "0";
if (tcpServices != null) {
if ((port < 1024) && resolve) {
// try to resolve port number into clear text
if ((tcpServices != null) && (output=tcpServices[(int)port-1]) != null) {
... | 8 |
public HitResult hit(int StartX, int StartY, int EndX, int EndY, Vector<GameElement> Elements)
{
HitResult Result = new HitResult();
Result.setHit(false);
Result.setHitElement(null);
while(StartX != EndX || StartY != EndY)
{
if(StartX > EndX)
... | 8 |
private void method45() {
aBoolean1031 = true;
for (int j = 0; j < 7; j++) {
anIntArray1065[j] = -1;
for (int k = 0; k < IdentityKit.length; k++) {
if (IdentityKit.designCache[k].aBoolean662 || IdentityKit.designCache[k].anInt657 != j + (aBoolean1047 ? 0 : 7)) {
... | 5 |
public String getFullName() {
String title = this.title == null ? "" : this.title.trim();
String firstName = this.firstName == null ? "" : this.firstName.trim();
String middleName = this.middleName == null ? "" : this.middleName.trim();
String lastName = this.lastName == null ? "" : this... | 5 |
public void restoreHealth(String userName){
try {
cs = con.prepareCall("{call SET_HEALTH_TO_MAX(?)}");
cs.setString(1, userName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} | 1 |
public static void print(int array[]){
System.out.println("****************Sort Array***************");
for(int i = 0; i < array.length;i++){
System.out.print(array[i] +" ");
}
System.out.println();
} | 1 |
private int calculateNotAppropriateWorkingDaysForTeacherIIIAndIV() {
int penaltyPoints = 0;
List<LinkedHashMap> teachersAllDay = getAllDaysTeacherTimeTable();
for (LinkedHashMap<String, LinkedHashMap> daysTimeTable : teachersAllDay) {
// Very dirty hack because of rush
... | 7 |
public void salvarSQL(String destino) {
String str[];
str = this.getSQL(this.src);
Formatter saida = null;
try {
saida = new Formatter(destino);
saida.flush();
for (int i = 0; i < str.length; i++) {
saida.format("%s ;\n\n", str[i]);
... | 2 |
public String getItemcode() {
return this.itemcode;
} | 0 |
private StringBuilder getSectionFoto() throws ClassNotFoundException, SQLException {
StringBuilder sb = new StringBuilder();
sb.append("<div class=\"bs-docs-section\">");
Utils.appendNewLine(sb);
sb.append("<h1 id=\"foto\" class=\"page-header\">Fotogaléria</h1>");
Utils.appendN... | 8 |
protected Class loadClass(String name, boolean resolve)
throws ClassFormatError, ClassNotFoundException {
name = name.intern();
synchronized (name) {
Class c = findLoadedClass(name);
if (c == null)
c = loadClassByDelegation(name);
if (c == nul... | 4 |
public JScrollPane getScrollPane_1() {
if (scrollPane_1 == null) {
scrollPane_1 = new JScrollPane();
scrollPane_1.setViewportView(getTaChat());
}
return scrollPane_1;
} | 1 |
private ArrayList<Point> aStarSearch(Point location, Point destination, Campus campus)
{
int traveled = 0;
PriorityQueue<CPoint> frontier = new PriorityQueue<CPoint>();
ArrayList<Point> solution = new ArrayList<Point>();
ArrayList<Point> observations;
HashMap<Integer,Point> explored = new Has... | 8 |
public Geometry getGeometry() {
if (geometry != null) {
return geometry;
}
render();
GeometryFactory gf = Helper.getGeometryFactory();
Coordinate[] labelCorners = new Coordinate[5];
SVGRect textBox = text.getBBox();
labelCorners[0] = new Coordinate(textBox.getX(), textBox.getY());
labelCorners[1] = n... | 1 |
private Object[] getDefaultValues (Class type) {
if (!usePrototypes) return null;
if (classToDefaultValues.containsKey(type)) return classToDefaultValues.get(type);
Object object;
try {
object = newInstance(type);
} catch (Exception ex) {
classToDefaultValues.put(type, null);
return null;
}
Obje... | 8 |
public void musStart(){
while(true)
{
hand = (hand + 1) % 4;
boolean discardFase = true;
deck = new MusDeck();
deck.shuffle();
for(int i = 0; i < player.length; i++) {
player[i].clearHand();
player[i].receive(deck.deal(4));
}
while(discardFase){
turn = hand;
player[t... | 7 |
private void parseChildren(Element e, XMLTag tag) {
NodeList children = e.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node nChild = children.item(i);
if (nChild.getNodeType() == Node.ELEMENT_NODE) {
Element eChild = (Element) nChild;
... | 6 |
public void saveLevel(Board board) throws LevelMisconfigurationException {
// the parent folder where the file is created inside
File parentFolder = new File(
CoreConstants.getProperty("editor.basepath"));
/**
* start to validate level configuration
*/
// list with positions of all diamonds
List<P... | 2 |
public boolean addScore(String playerName, int scored) throws CouldNotSaveFileException {
Score score = new Score(scored, playerName);
if (scores.size() < MAX_SCORES || score.compareTo(scores.getLast()) < 0) {
ListIterator<Score> it = scores.listIterator();
while (it.hasNext() && it.next().compareTo(score)... | 8 |
private static void add(Map<Class<?>, Class<?>> forward,
Map<Class<?>, Class<?>> backward, Class<?> key, Class<?> value) {
forward.put(key, value);
backward.put(value, key);
} | 6 |
public static Vector<String> parseSquiggleDelimited(String s, boolean ignoreNulls)
{
final Vector<String> V = new Vector<String>();
if ((s == null) || (s.length() == 0))
return V;
int x = s.indexOf('~');
while (x >= 0)
{
final String s2 = s.substring(0, x).trim();
s = s.substring(x + 1).trim();
i... | 7 |
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file = new File("C:/1.txt");
in = new BufferedReader(new FileReader(file));
String line;
while ((line = in.readLine()) != null) {
int n = Integer.parseInt(line);
System.out.println(fibonacci(n));
}
... | 1 |
private boolean optionsHasAnyOf( OptionSet options, Collection<OptionSpec<?>> specs ) {
for ( OptionSpec<?> each : specs ) {
if ( options.has( each ) )
return true;
}
return false;
} | 4 |
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
} | 1 |
@Test
public void testValue() {
System.out.println("value");
Equals<Double> instance = this._instance;
for (int i = 0; i < this._values.length; i++)
for (int j = 0; j < this._values.length; j++) {
boolean expResult = false;
for (Equals<Double> e : ... | 5 |
public MBeanServerConnection connect() throws MBeanServerConnectionException {
if (vmd == null) {
throw new MBeanServerConnectionException(ReturnCode.ServerNotFound);
}
try {
VirtualMachine vm = VirtualMachine.attach(vmd);
String connectorAddress = getConnectorAddress(vm);
if (connectorAddress == nu... | 4 |
public void createStatesForConversion(Grammar grammar, Automaton automaton) {
initialize();
StatePlacer sp = new StatePlacer();
String[] variables = grammar.getVariables();
for (int k = 0; k < variables.length; k++) {
String variable = variables[k];
Point point = sp.getPointForState(automaton);
State s... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Interval other = (Interval) obj;
if (end == null) {
if (other.end != null)
return false;
} else if (!end.equals(other.end))
ret... | 9 |
@Override
public String toString() {
String output = "";
if (isStart)
output += "(START)\t";
else if (isFinal)
output += "(FINAL)\t";
else
output += "\t";
for (String key : transitions.keySet()) {
output += key + "\t";
}
output += "\n" + name + "\t";
for (String key : transitions.keySet()) ... | 5 |
public static void main(String[] argv)
{
JFrame mainWindow = new JFrame("Übung3");
mainWindow.setLayout(new GridLayout(rows, columns));
mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainWindow.setBackground(Color.white);
mainWindow.setSize(800, 800);
mainWindow.setLocationRelativeTo(null);
... | 7 |
private Instances[] computeInfoGain(Instances instances, double defInfo, Antd antd){
Instances data = new Instances(instances);
/* Split the data into bags.
The information gain of each bag is also calculated in this procedure */
Instances[] splitData = antd.splitData(data, defInfo);
Instance... | 7 |
public double calculate(HttpServletRequest request) {
int shape = Integer.parseInt(request.getParameter("s"));
// double result;
switch (shape) {
case 0:
calc = new RectangleCalculator();
return calc.calcArea(parseValue(request.getParameter("l... | 8 |
public static int[] factorsOf(int number) {
if (number < 0) {
throw new IllegalArgumentException("Error: int cannot be < 0!");
}
int half = Math.round(number / 2);
ArrayList<Integer> factorsList = new ArrayList<Integer>();
for (int j = 1; j <= half; j++) {
if (number % j == 0) {
factorsList.add(j);... | 4 |
public static void main(String args[]) {
TowerDefenseGame game = new TowerDefenseGame();
game.initConnection();
while (!game.checkInitalBridge()) {
try {
sleep(delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Try Create");
}
} | 2 |
@Override
public List<TrainingDataDTO> getTraningDataByCrisisAndAttribute(int crisisID,
int modelFamilyID,
int fromRecord,
... | 8 |
public static void runCPP(final String s2) {
Thread t = new Thread(){
public void run() {
String s = new String("\n#include <iostream>\n" +
"using namespace std;\n" +
"int main() {\n" +
s2 + "\n" +
"return 0; \n}");
ArrayList<String> data = new ArrayList<String>();
... | 5 |
public float[][] GenerateFurniHeightMap()
{
float[][] FurniHeightMap = new float[this.GrabModel().MapSizeX][this.GrabModel().MapSizeY];
for(int x = 0; x < this.GrabModel().MapSizeX; x++) //Loopception courtesy of Cobe & Cecer
{
for(int y = 0; y < this.GrabModel().MapSizeY; y++)
{
if(FurniCollisionM... | 4 |
private AnimationType generateAnimation(String animation) {
if (animation.contains("MoveCardAnimation")) {
if (animation.contains(":")) {
// has parameters pass them to the constructor
return new MoveCardAnimation(animation.split(":")[1]);
} else {
return new MoveCardAnimation();
}
}
... | 2 |
public BasicFileFilter() {} | 0 |
@Override
public void process() {
session.log("Loading class for client: \""+clientClassName+"\"");
Class clnMain;
try {
clnMain = Class.forName(clientClassName);
}catch(ClassNotFoundException clnfe){
session.log("Unable to load class\n"+clnfe.toString());
return;
... | 6 |
public static double toRadians(double x)
{
if (Double.isInfinite(x) || x == 0.0) { // Matches +/- 0.0; return correct sign
return x;
}
// These are PI/180 split into high and low order bits
final double facta = 0.01745329052209854;
final double factb = 1.99784475... | 3 |
private static boolean tryToOccupyUrinalAndSurvive() {
int urinalToOccupy = askForNumberBetween( "Which Urinal shall be occupied?", minUrinals, bathroom.urinalCount() );
UrinalStatus status = bathroom.occupyUrinalVO( urinalToOccupy-1 );
switch( status ) {
case FREE_SAVE:
print( "Aaaaah. That's better..." )... | 3 |
public void toggleAction(Action a, boolean is) {
if (a == null) return ;
if (! a.actor.inWorld()) {
I.complain(a+" TOGGLED BY DEFUNCT ACTOR: "+a.actor) ;
}
final Target t = a.target() ;
List <Action> forT = actions.get(t) ;
if (is) {
if (forT == null) actions.put(t, forT = new L... | 6 |
public boolean checkAccess(Administrador admin){
try {
PreparedStatement ps =
this.mycon.prepareStatement("SELECT * FROM Administradores WHERE userName=? AND passwd=?");
ps.setString(1, admin.getNombre());
ps.setString(2, admin.getPassword());
... | 1 |
public int getRealWidth() {
int c = 0;
for (int x = 1; x < width; x++) {
for (int y = 0; y < height; y++) {
int col = pixels[x + y * width];
if (col == -1 || col == 0xffff00ff) c++;
}
if (c == height) return x;
c = 0;
}
return width;
} | 5 |
public void setSysMessage(String sysMessage) {
this.sysMessage = sysMessage;
} | 0 |
public boolean overTwoTimes(int[] counts) {
for (int i = 0; i < counts.length; i++) {
if (counts[i] > 1)
return false;
}
return true;
} | 2 |
private static double getHighThreshold(ImageProcessor gradient, double percentNotEdges){
gradient.setHistogramSize(64);
int[] histogram = gradient.getHistogram();
long cumulative = 0;
long totalNotEdges = Math.round(gradient.getHeight()*gradient.getWidth()*percentNotEdges);
int buckets = 0;
for(; buckets < ... | 2 |
public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
return false;
} catch (UnsupportedAudioFileException e) {
return false;
} catch (LineUnavailableException... | 3 |
private void dehighlight() {
pane.tablePanel.dehighlight();
pane.grammarTable.dehighlight();
} | 0 |
@Override
public synchronized void advance(double smpSecondsElapsed,double seqSecondsElapsed){
int chan=output.length;
for(int i=0;i<chan;i++) output[i]=0;
boolean stop=terminate;
Node n=head.next;
while(n.next!=null){
double[] signal=n.sound.getSignal(smpSecondsElapsed,seqSecondsElapsed);
if(signal==n... | 6 |
void updateInOut(FlowBlock successor, SuccessorInfo succInfo) {
/*
* First get the gen/kill sets of all jumps to successor and calculate
* the intersection.
*/
SlotSet kills = succInfo.kill;
VariableSet gens = succInfo.gen;
/*
* Merge the locals used in successing block with those written by this
... | 3 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RelationshipFamilyEntity that = (RelationshipFamilyEntity) o;
if (relationshipId != that.relationshipId) return false;
if (familyId1 != null ? ... | 8 |
private static void printLCS(int[][] lcs, char[] x, char[] y, int i, int j) {
if(i >0 && j >0 && x[i-1]==y[j-1] ){
printLCS(lcs,x,y,i-1,j-1);
//Prints only if X == Y...
System.out.print(x[i-1]);
}else if(j>0 && (i==0 || lcs[i... | 9 |
private static void createDirectory(FileSystem fileSystem, String path) throws TestFailedException {
try {
fileSystem.createDirectory(path);
if (!fileSystem.pathExists(path))
throw new TestFailedException("I created the directory " + path + ", but pathExists says it does not exist");
} catch (PathNotFoun... | 4 |
public void addNode(int value, int leftValue, int rightValue) {
if (leftValue == -1 && rightValue == -1) {
return;
}
Node node = this.getNodeByValue(value);
if (node == null) {
System.out.println("Error, no node with value:" + value);
... | 5 |
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.