method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ca52d488-0a31-4344-bcdc-f56e59927e80 | 7 | public static void getManifestChangeLog(ExternalRefs.Reference latestRef,
Archive archive,
ArchiveResolver resolver,
ChangeLogCallback callback) throws IOException {
if (archive.g... |
43a9bdd0-936c-4083-860c-4197ca138d5f | 0 | @Override
public void setName(String name) {
this.name = name;
} |
5065445a-29e3-422a-9e71-dd56bf6c0a00 | 3 | public void removeTails()
{
if (getEntities() == null)
return;
List toberemoved = new ArrayList();
List<Tail> tails = getEntities().getList(Tail.class);
for (Tail other : tails)
{
if (other.getOwner() == this)
toberemoved.add(other);
... |
fb533be6-6fa0-488e-ad67-b89a6ac1ead4 | 9 | public static void main(String args[]) {
Glob glob = new Glob("Dan* Easter?ing");
String name;
String format = "Glob matches%s %s\n";
String output;
boolean matches;
System.out.println(glob.toString());
name = "Mario Lopez";
matches = glob.matches(name);... |
ccaf4f41-353e-4d7e-9b3f-9aeee9fe9c11 | 8 | public static boolean canBindAllP(Cons plObjects, Cons values) {
{ Stella_Object obj = null;
Cons iter000 = plObjects;
Stella_Object value = null;
Cons iter001 = values;
for (;(!(iter000 == Stella.NIL)) &&
(!(iter001 == Stella.NIL)); iter000 = iter000.rest, iter001 = iter001... |
60d6b62a-9b5e-40e8-8dcd-59c942c8710f | 2 | private OSCBundle convertBundle() {
// skip the "#bundle " stuff
streamPosition = 8;
Date timestamp = readTimeTag();
OSCBundle bundle = new OSCBundle(timestamp);
OSCByteArrayToJavaConverter myConverter
= new OSCByteArrayToJavaConverter();
while (streamPosition < bytesLength) {
// recursively read thr... |
27643ccc-e5b9-4469-9f0f-a0a40ae0bb1f | 1 | public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
} |
8ba034a5-a559-46ab-aca6-ab00e9a9840f | 0 | void print() {
System.out.println(getModel() + " " + getPower() + " " + getNumberCylinders());
} |
815a31df-f0b4-42b2-bc2c-1be5d01125d5 | 7 | void setSelectionHalo(int pt) throws ScriptException {
if (pt == statementLength) {
viewer.setBooleanProperty("selectionHalos", true);
return;
}
if (pt + 1 < statementLength)
checkLength3();
boolean showHalo = false;
switch (statement[pt].tok) {
case Token.on:
case Token.selected:
showHalo = t... |
c9eb261b-cbac-44fb-94df-b898b7078ac2 | 4 | private boolean isWhiteSpace(int ch) {
return (ch == ' ' || ch == '\t' || ch == '\f' || ch == '\r' || ch == '\n');
} |
3bd245df-a61a-4301-b802-9d39337517cc | 9 | private void drawTodos(JPanel pnlTodos, JButton btnRefresh)
{
pnlTodos.removeAll();
pnlTodos.add(btnRefresh);
count = 0;
for( JTextPane todo : visualTodos)
{
final int i = count;
todo.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event)
{
ToDoList data = toDoLis... |
fd4a1ec5-c863-4753-94d1-b2575daa9fcf | 6 | 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 fe... |
27edbeab-e9b2-459a-b7e2-8ca7ad3bac28 | 3 | public void viderSac(){
if(Carte.isCreated()){
Case c;
int x;
int y;
Carte carte = Carte.getInstance(0, 0, 0, null);
for(int i=0; i< this.contenu.size();i++){
do{
x = (int)(Math.random()*(carte.getNbCaseX()-1));
y = (int)(Math.random()*(carte.getNbCaseY()-1));
}while(carte.getCarteP... |
4fa9b493-1f32-45c7-bfae-4219bc498ddc | 8 | public static void main (String[] args) throws FileNotFoundException, IOException
{
String allString = "";
File dir1 = new File(onMac);
//"C:/Documents and Settings/fsimon0/My Documents/Cubisima Final/"
String[] datefolderChildren = dir1.list();
for (int i=0; i< ... |
66544215-b633-4ef4-90e8-a8dd20731d64 | 6 | protected boolean getJumpTarget(String label, int type, XJump jump) {
if (type != 2 && hasLabel(label)) {
if (type == 0 && _break != null) {
jump.setTarget(_break);
return true;
} else if (type == 1 && _continue != null) {
jump.setTarget(_continue);
return true;
}
}
return false;
} |
7aaed49c-362d-47b2-afc9-6e31e5078e15 | 7 | public void tpToWorld(World world, Location location, Player player, Boolean mode){
//TP Player to world!
if(adventourworlds.copyWorldAllowed(world, player.getName()) || this.resettingWorld.containsKey(player)){
if (mode){
world = adventourworlds.isAndGetCopyWorld(world, player);
}
Location locat... |
32d3cd3a-e91d-463f-9d57-abc7e1863f8c | 4 | @Test
public void oneSymbolTest()
{
final int ROW = 0;
final int COLUMN = 2;
final Mark MARK = Mark.X;
ticTacToeBoard_STUDENT.setMark(ROW, COLUMN);
for (int i = 0; i < TicTacToeBoard.ROW_COUNT; i++)
{
for (int j = 0; j < TicTacToeBoard.COLUMN_COUNT; j++)
{
if (i == ROW && j == COLUMN)
{
... |
40a5637e-bde6-42c1-b019-4dbc1b9df3bb | 3 | @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("rowset"))
memberCorporations = getString(attrs, "name").equals("memberCorporations");
else if (qName.equals("row")) {
if (memberCorporations) {
ApiMemberCorporation mem... |
3db6e073-4a7c-497b-9282-d005a5b124d8 | 7 | public void sink() {
boolean fall = true;
if(super.getPosition()[1]<Ocean.getInstance().getDepth()-100){
for(int i=0; i<Ocean.getInstance().getOceanObjects().size();i++){
if(Ocean.getInstance().getOceanObjects().get(i).getObject().equals("Stone")){
if(Ocean.getInstance().getOceanObjects().get(i).getPosi... |
a49db1fa-ac3d-48bf-9f64-3107516e5f56 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idServidor != null ? idServidor.hashCode() : 0);
return hash;
} |
7a309ce9-1ada-4f19-a46b-7f5e27772671 | 3 | public int getNewCash() {
int cash = 0;
int won = 0;
for (int i = 0; i < player.numberOfHands(); ++i) {
if (rules.wins(player.getActiveHand(), dealer.getActiveHand())) {
cash += rules.getOdds(player.getActiveHand()) * (double) player.getBet();
won = 1... |
f9a4261c-7a31-49e0-8072-336558eb6b1a | 8 | public static String[] substringsBetween(String str, String open, String close) {
if (str == null || isEmpty(open) || isEmpty(close)) {
return null;
}
int strLen = str.length();
if (strLen == 0) {
return Arrs.EMPTY_STRING_ARRAY;
}
int closeLen = cl... |
000d3d17-ec5a-4df7-bb32-56a4d2c22385 | 1 | public void addLoot(ItemStack item)
{
if(item == null) return;
loot.add(item);
} |
a5480c12-62c7-42a2-81df-c46e7f64c7f8 | 1 | private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(new BoxLayout(getJPanel(), BoxLayout.X_AXIS));
}
return jPanel;
} |
8475b72a-a1c1-4e12-9b5b-41c7863bfb59 | 5 | public String toString() {
StringBuilder sb = new StringBuilder();
if( rank == 10 ) {
sb.append('T');
} else if( rank == 11 ) {
sb.append('J');
} else if( rank == 12 ) {
sb.append('Q');
} else if( rank == 13 ) {
sb.append('K');
} else if( rank == 14 ) {
sb.append('A');
} else {
sb.app... |
e4aeac9d-0d73-481a-808e-c1bb5ca574db | 6 | @Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("---------------------------------------------------------------------\n");
buf.append("SingularValueDecomposition(A) --> cond(A), rank(A), norm2(A), U, S, V\n");
buf.append("--------------------------------------... |
378c3e9e-a6f5-417e-b5dd-b6acaee1890c | 6 | public void draw(Graphics2D g) {
for(int row = rowOffset; row < rowOffset + numRowsToDraw; row ++) {
if(row >= numRows) break;
for(int col = colOffset; col < colOffset + numColsToDraw; col++) {
if(col >= numCols) break;
if(map[row][col] == 0) continue;
int rc = map[row][col];
... |
b1333f06-0f2c-42e3-be7d-3ca086be4dad | 7 | @Override
public void actionPerformed (ActionEvent e) {
if (e.getSource() == bRead){
solids = SolidFileIO.readSolids(fileName);
doOutput();
}
if ((e.getSource() == bSort1) && (solids != null)){
// sort Volume
solids = SolidFileIO.readSolids(fil... |
40376130-560f-4bf4-bdc4-e25c8c2cf6df | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
4b67816c-d420-41a9-a958-764b7e851750 | 7 | private void showDialog(DrawingElement e) {
if (!EventQueue.isDispatchThread())
throw new RuntimeException("must be called by the Event Dispatch Thread");
JDialog d = null;
if (e instanceof AbstractLine)
d = createDialog((AbstractLine) e);
else if (e instanceof AbstractRectangle)
d = createDialog((Abst... |
cae4f67c-bf32-41fb-95a2-9cb821232f2c | 8 | public boolean guardarcambios(Integer id, String estado) {
boolean resultado = false;
try {
logger.error("algo");
if (estado!= null) {
// Conectamos si no está conectado
if (!isConectado()) {
conectar();
}
... |
5a3d9788-1361-4c4d-a872-03028c1d2dfb | 9 | @Override
public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,
TypePath typePath, Label[] start, Label[] end, int[] index,
String desc, boolean visible) {
checkStartCode();
checkEndCode();
int sort = typeRef >>> 24;
if (sort != TypeReference.LOCA... |
9a04c37d-97b8-4c12-a8b6-6fe502b0a20f | 1 | String FirstReverse(String str) {
StringBuilder sb = new StringBuilder();
for (int i = str.length() -1 ; i >= 0; i--) {
sb.append(str.charAt(i));
}
return sb.toString();
} |
13f659a5-00cb-4d87-9b39-34158c899142 | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectByteMap ) ) {
return false;
}
TObjectByteMap that = ( TObjectByteMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectByteIterator iter = ... |
c3d2eeb7-4996-4d79-9038-947ca984058b | 3 | public void updateBankAmount(String bankName,float newAmount) throws SQLException{
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="UPDATE familydoctor.bank SET accBalance="+newAmount+" ... |
522157f9-711c-4737-9607-8d8881320234 | 8 | public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
if (actionCommand.equals("Edit class name"))
dialogues.editClassName();
else if (actionCommand.equals("Delete this class")) {
dialogues.deleteClass();
} else if (actionCommand.equals("Delete a variable")) {
dialog... |
84dd3fa4-54ba-4c77-a4cc-72c0b8061fe6 | 0 | public static void main(String[] args) {
Card ace = new Card("Ace", "Spades", 1);
Card jack = new Card("Jack", "Spades", 11);
ace.matches(jack);
System.out.println(ace.toString());
System.out.println(jack.toString());
} |
75e0bc08-5ada-4b6a-819f-3284d0d712b0 | 5 | public void update(int delta) {
stateMachine.update();
if(parent.isCurrentlyMoving()) {
float xDiff = facing == Direction.WEST ? -DISTANCE : facing == Direction.EAST ? DISTANCE : 0;
float yDiff = facing == Direction.NORTH ? -DISTANCE : facing == Direction.SOUTH ? DISTANCE : 0;
this.position = parent.getPos... |
40987be5-b119-497b-ac13-255b13b17dce | 4 | private static void renderOverlay(
Rendering rendering, World world, Boardable path[], Colour c
) {
final Batch <Tile> tiles = new Batch <Tile> () ;
if (path != null) for (Boardable b : path) {
if (b instanceof Tile) tiles.add((Tile) b) ;
}
if (tiles.size() > 0) {
final TerrainMesh ove... |
7ee53deb-7af1-4bbc-95e5-e4a5cf38537b | 8 | public void validateLists()
{
// Remove non-existant creations
Iterator<Path> createdIterator = createdFiles.iterator();
while(createdIterator.hasNext())
{
if(!createdIterator.next().toFile().exists())
{
createdIterator.remove();
}
}
// Remove non-existant modifications
Iterator<Path> modif... |
b652b5b9-d76f-4352-92ab-7e1102c799dd | 7 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
boolean first = true;
for(;;){
int n = Integer.parseInt(br.readLine());
if(n == 0){
... |
e9018d0c-f3e4-4f9c-a93b-0283409f62b7 | 1 | private void broadcast(Command com) throws IOException {
// System.out.println("Broadcasting to all users.");
for (Network client : clients.values()) {
client.send(com);
}
} |
119ca17e-ccab-490b-8962-340ce98d2adb | 6 | public void cerrarArchivo(){
try{
if( bufferOut!=null ) this.bufferOut.close();
if( fileOut!=null ) this.fileOut.close();
if( printIn!=null ) this.printIn.close();
if( bufferIn!=null ) this.bufferIn.clo... |
0da16cc5-bf10-40a2-bd00-d8ed8c86abba | 2 | @Override
public Object invoke(Context context,List<Object> arguments) {
String string = "";
for (Iterator<Object> i = arguments.iterator();i.hasNext();){
string+=i.next();
if (i.hasNext()) string+=" ";
}
logView.error(string);
return null;
} |
8a36d6b8-aca6-41c0-aeee-1f1fca6eae47 | 1 | private String[] getCommandline() {
System.out.print(PROMPT);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String input = "";
try {
input = in.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return input.split("\\s");
} |
7afa9cbd-5317-4d41-a3fe-c30eabe6b59b | 2 | private static String normalizeName(String name) {
StringTokenizer tokenizer = new StringTokenizer(name, SEPARATOR);
StringBuilder builder = new StringBuilder();
while (tokenizer.hasMoreTokens()) {
if (builder.length() > 0) {
builder.append('.');
}
builder.append(tokenizer.nextToken());
}
return ... |
3e673955-ba7a-4d41-aa71-22770aab10bc | 1 | private String removeSpanSort(String content) {
String buf = "";
int idx = 0;
int aStart = 0;
int aEnd = -7;
while (content.indexOf("<span class=\"smwsortkey\">", idx) != -1) {
aStart = content.indexOf("<span class=\"smwsortkey\">", idx);
buf += content.substring(aEnd+7, aStart);
aEnd = content.inde... |
9d93c9fb-a151-4cfd-bdb0-244f398b3178 | 3 | public Object getValueAt(int row, int col) {
if(row>-1 && col>-1 && data!=null)
return data[row][col];
else
return null;
} |
07637b69-a71c-4460-9c2b-88e344e90996 | 5 | public static void main( String[] args ) throws IOException
{
InputStreamReader iStream = new InputStreamReader( System.in );
BufferedReader bReader = new BufferedReader( iStream );
String inputText = bReader.readLine();
System.out.print( "Input text is : '" );
System.out.pr... |
55ddb490-4397-4a93-bb54-e59020095781 | 3 | public ParkingSpot searchParkingSpot(ParkingUser user)
{
TreeSet<ParkingSpot> userType = garage.get(user.toString());
ParkingSpot spot = null;
for(ParkingSpot x: userType)
if(x.isAvailable() && x.isConnected())
{
spot = x;
break;
... |
f0000c42-4b45-4412-88bb-80264a0c4d2a | 0 | private int getShortLittleEndian(byte[] a, int offs) {
return (a[offs] & 0xff) | (a[offs + 1] & 0xff) << 8;
} |
75d257d1-0ed9-4931-aa44-9a21b0261cb6 | 6 | public Quantity getFuelConsumption(final Quantity distance) {
Double result = 0d;
final Double convDistance = distance.convert(Unit.KILOMETER).getAmount();
// calculate with multiple trips if distance exceeds the max range of this airplane
final double numTrips = Math.ceil(convDistance / this.specs.getMaxRange... |
04bb05eb-3d0e-468c-bc0f-279a09df5fc6 | 8 | public int maxPoints(Point[] points) {
if(points.length < 3)
return points.length;
int result = 0;
HashMap<Double, Integer> map = new HashMap<>();
for(int i = 0; i < points.length; ++i){
map.clear();
int samePoint = 0;
int pointsInLine = 1;
for(int j = i + 1; j < points.length; ++j){
doubl... |
96e099ef-5b57-486a-8bec-f91cba240772 | 9 | static public void test_changeArray102() throws Exception {
{
int[] input = { 1 };
int[] expected = { 1 };
int[] actual = ArrayQuestions.changeArray102( input );
if ( expected.length != actual.length ) {
throw new Exception( "Test fail... |
e88388ad-fd6c-41a0-bd9e-df307cb764e4 | 7 | public static String numberToString(double d, int base) {
if (d != d)
return "NaN";
if (d == Double.POSITIVE_INFINITY)
return "Infinity";
if (d == Double.NEGATIVE_INFINITY)
return "-Infinity";
if (d == 0.0)
return "0";
if ((base < ... |
b46012a9-aa77-4bce-a181-c5fb1c786ba3 | 1 | public static int[] mergeSort(int[] array,int start,int end){
if(end - start >0){ //should >0
int mid = (start+end) / 2;
mergeSort(array,start,mid); // sort left
mergeSort(array,mid+1,end); // right mid need add 1
merge(array,start,mid,end); // there do not add 1
}
return arr... |
99ef1466-9377-4cc3-8a5c-4bcb4345e338 | 9 | protected MummyWhite mummyWhiteMove(short[][][] maze, Human man) {//Horizontal then vertical
//This method was written using a different logic than the current one
MummyWhite tam = new MummyWhite(this.getX(),this.getY());
if (tam.samePlace(man)) {
return tam;
} else {
... |
52f54767-f8c5-4e67-975f-d406d84739e2 | 2 | public boolean hasNext() throws IOException {
while (!tokenizer.hasMoreTokens()) {
String line = reader.readLine();
if (line == null) {
return false;
}
tokenizer = new StringTokenizer(line);
}
return ... |
85166ee7-94a1-4b89-9821-497b47bdc912 | 3 | private void insertionSort(List<T> list, int startPos, int sublistOffset) {
for (int nextUnsortedPos = startPos + sublistOffset;
nextUnsortedPos < list.size();
nextUnsortedPos += sublistOffset) {
for (int nextPosToCheck = nextUnsortedPos;
nextPosToCheck > startPos;
... |
08263592-38db-41e3-b6fb-6fc159718488 | 5 | public String replace(String str)
{
StringBuffer sb = new StringBuffer();
char strArray[] = str.toCharArray();
int i;
for(i = 0; i < strArray.length - 1;)
{
if(strArray[i] == '$' && strArray[i + 1] == '{')
{
int begin = i += 2;
... |
800a123d-b542-472d-b8fd-e0ebd8489273 | 3 | public static double binomial(double p, int n, int k) {
if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero");
if (k > n) throw new IllegalArgumentException("\nk is greater than n");
return Math.floor(0.5D + Math.exp(Stat.logFactorial(n) - Stat.logFactorial(k) -... |
5521935f-1f6f-4f36-bdec-8b50cfe560d5 | 7 | @Override
public boolean probablyPrime(BigInteger number, int repeats, boolean enhancedVerbosity) {
if( number.equals(new BigInteger("2") ))
return true;
for (int i = 0; i < repeats; ++i) {
if (logger != null && enhancedVerbosity) {
logger.setStepName(String.... |
599470d5-7eb9-480d-8c28-85508208408e | 7 | static <L, X> Fst<L> intersect(Fst<L> left, Fst<L> right,
F1<L, X> intersectOn) {
Fst<L> intersection = new Fst<L>();
BooleanRing br = new BooleanRing();
LinkedList<StatePair> stack = new LinkedList<>();
Map<StatePair, State> chart = new HashMap<>();
for (State l : left.initialStates) {
for (State r... |
3e07c48e-d6dc-42a3-aaf8-3e50d052ec0e | 7 | int readInt () {
int ch;
int assembly=0;
try {
ch = in.read();
while(ch==' ' || ch=='\n' || ch=='\r') {
ch = in.read();
}
if (ch == '-') {
return -readInt();
}
while(ch>='0' && ch<='9') {
... |
c765dfc8-11ed-4dca-bc65-db8509983f21 | 3 | private MaskValue findOpenBomb()
{
for (MaskValue mask : mMasks)
if (mask.isFlag() && mask.isOpen()) return mask;
Log.exception("No Open Bomb Mask Defined!");
Sweeper.forceStop();
return null;
} |
dc30f348-758a-4718-bf19-48728f2e6cb7 | 2 | public void keyReleased(KeyEvent e){
if (e.getKeyCode() == KeyEvent.VK_LEFT){
leftPressed = false;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT){
rightPressed = false;
}
} |
edcec49c-4eec-4097-b4f6-d0e75d2a9814 | 0 | @Basic
@Column(name = "POP_USUARIO")
public String getPopUsuario() {
return popUsuario;
} |
b70a147e-29e4-4219-8ad2-9870580c393d | 3 | public int adxLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return (2 * optInTimePeriod) + (this.unstablePeriod[FuncUnstId.Adx.ordinal(... |
cb737674-37d4-40c1-b991-7d8385a1f6b9 | 1 | public void run(String classname, String[] args)
throws Throwable
{
Class c = loadClass(classname);
try {
c.getDeclaredMethod("main", new Class[] { String[].class })
.invoke(null, new Object[] { args });
}
catch (java.lang.reflect.InvocationTargetE... |
4b97cdb8-739d-4513-8853-6addd5a6a2a1 | 9 | @Override
public void calculate(List<Connections> connections, ValuesProvider valuesProvider, Layer targetLayer) {
if (connections.size() > 0) {
List<Connections> notBias = new ArrayList<>();
Connections bias = null;
for (Connections c : connections) {
// bias layer scenarios
if (Util.isBias(c.... |
43f60504-e701-4d56-b773-e29b8e5ac34b | 2 | private Move_Two processInput(String xmlString) {
//goal is to convert XML representation, embedded
//in xmlString, to instance of move object. Ideally
//this could be done auto-magically, but these technologies
//are heavyweight and not particularly robust. A nice
//compromise i... |
f6a62c66-d535-4f02-adaf-49886ffa4917 | 4 | public void evaluateNode(){
double sum = 0;
for(Link l:inputNodes){
if(l.isActive()) {
sum += l.getWeight() * l.getStartNode().getValue();
}
}
switch(functionType){
case 0: {
value = sum;
break;
... |
6a029d78-4a65-4ddd-ba7e-809fb6d34e2b | 4 | public void execRequest() {
if (!sqlCommand.execRequest()) {
if (sqlCommand.getErrorCode() == 0) {
if (GUIUtilities.question_YES_NO (Constantes.MESSAGE_TABLE_EXISTE_DEJA) == JOptionPane.YES_OPTION ) {
if (sqlCommand.execRequest(true))
GUIUtilities.messageHTML(Utilities.getLangueMessage(Consta... |
db820819-5d00-432f-95bf-140869c4b052 | 5 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
//try {
ArrayList <String> hexNumbers = new ArrayList<String>();
Scanner diskScanner = new Scanner(new File("E:/1.txt"));
char[] hexArray = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e',... |
03d6eb51-bd82-4f8b-aba5-2f26ed70e8e6 | 9 | private static int solve(int n , int m,int[] costM, int[] costN) {
if(n == 1 && m == 1 ) return 0;
int[] copyOfN = Arrays.copyOf(costN, n-1);
int[] copyOfM = Arrays.copyOf(costM, m-1);
Arrays.sort(copyOfN);
Arrays.sort(copyOfM);
if(costM.length == 0){
if(copyOfN.length == 1){
return copyOfN[0] ... |
a8942adf-41fa-4a44-990b-804ae9a1ac60 | 7 | public static final Object[][][] getListFileGrid(final ListFile var)
{
if(var==null)
return new String[0][0][];
final CMProps p=p();
final Object[] objs=p.sysLstFileLists;
if(objs[var.ordinal()]==null)
{
final List<String> V=CMParms.parseSemicolons(getRawListFileEntry(var.getKey()),true);
final Obje... |
08e96fe2-fd12-4738-b88b-4a971db7c020 | 0 | public SingleQuestionTextArea()
{
super();
setFont(DefaultUIProvider.getQuestionFont());
setEditorKit(new HTMLEditorKit());
setEditable(false);
setBorder(DefaultUIProvider.getDefaultEmptyEtchedEmptyBorder());
setMargin(new Insets(20, 20, 20, 20));
setFocusabl... |
458ae0d2-9b63-4ddb-9e63-252c5d365f76 | 8 | @Override
protected void drawInternalU(UGraphic ug, Area area) {
final Dimension2D dimensionToUse = area.getDimensionToUse();
final StringBounder stringBounder = ug.getStringBounder();
final int textHeight = (int) getTextHeight(stringBounder);
ug.getParam().setColor(getForegroundColor());
ug.getParam().setB... |
7277306a-5b9b-4fe8-8c14-64250725166f | 8 | public void sortAndCount(int[] array, int arrayLen) {
if (arrayLen <= 1) {
return;
}
int midIndex = (arrayLen - 1) / 2;
/**
* left array: [0, (arrayLen-1)/2] right array: [arrayLen/2+1,
* arrayLen-1];
*/
int leftArrayLen = (arrayLen - 1) / 2 + 1;
int rightArrayLen = arrayLen - leftArrayLen;
... |
1f1e8099-3c2f-4122-a766-27ef9f6bbcf1 | 1 | private static String getFileContents(String filename)
throws IOException, FileNotFoundException
{
File file = new File(filename);
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = ... |
e3e39c72-a546-4d9e-bab3-ef42bb8f925c | 9 | @Override
public void initWithMessage(String messageString) {
Matcher matcher = PATTERN.matcher(messageString);
if (matcher.matches()) {
if (!matcher.group(1).equals("null"))
this.setplayerPositionID1(Integer.parseInt(matcher.group(1)));
if (!matcher.group(2).equals("null"))
this.setplayerPositionID... |
7f193bb1-51b8-4d21-a32f-a603c86923a9 | 9 | private void ssaStatements(DirectGraph dgraph, HashSet<String> updated) {
// try {
// DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr1_my.dot"));
// } catch(Exception ex) {ex.printStackTrace();}
for (DirectNode node : dgraph.nodes) {
// if (node.id.endsWith("_inc")) {
// System.... |
d6144e9e-f436-4d04-a6f0-4f8680cc618c | 3 | private void computePaths(Vertex source) {
source.setMinDistance(0.0);
PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>();
vertexQueue.add(source);
while (!vertexQueue.isEmpty()) {
Vertex u = vertexQueue.poll();
// Visit each edge exiting u
for (Edge e : u.getAdjacencies()) {
Vertex ... |
74ed5196-bc8b-4cd6-b0ea-2ed49373cb69 | 0 | @Override
public JComponent getComponent() {
return this.component;
} |
f1bf82e2-81c4-4ff7-81ef-22054ed1a3e8 | 2 | public void testTrackRep()
{
// Gets les rallizes
try
{
Record r = GetRecords.create().getRecord(10272);
for (int i = 1; i <= 10; i++)
r.getTrackRep(i);
}
catch (Exception e)
{
e.printStackTrace();
assert (false);
}
} |
9beaa734-2fa7-484b-9b0c-b83c2897fe52 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Contacto other = (Contacto) obj;
if (apellido == null) {
if (other.apellido != null) return false;
} else if (!apellido.equals(other.apellido)... |
ef36867c-759d-4a8f-80d7-049ae2955ba1 | 2 | @Override
public int hashCode() {
int result = eventType.hashCode();
result = 31 * result + (event != null ? event.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
return result;
} |
1f7f05a4-7a6c-44c6-9a95-643a0e4121d2 | 0 | @Override
public String toString() {
return ip + ":" + dv;
} |
ee293ad4-9955-45ba-86a6-855da4facd38 | 3 | public void go_left(){
if( this.direction != Tank.direction_left){
this.direction = Tank.direction_left ;
}
else{
if(this.location_x - this.speed >= 0 && ifCanWalkInThisDirection()){
this.location_x -= this.speed ;
ifGetProps();
}
}
} |
65e1989e-3e5a-4ef2-ba72-773fe74228b1 | 9 | @SuppressWarnings("unchecked")
public static SignalReader createSignalReader(SignalEntry signalEntry){
Properties unisensProperties = UnisensProperties.getInstance().getProperties();
String readerClassName = unisensProperties.getProperty(Constants.SIGNAL_READER.replaceAll("format", signalEntry.getFileFormat().getF... |
a0bdf224-bf90-4ac7-8ca7-38f9640e0883 | 0 | public List findByHint(Object hint) {
return findByProperty(HINT, hint);
} |
76254636-dd83-472f-9c5b-dd8ec04cda5c | 2 | private void broadcastMessage(final List<String> translatedList) {
Player[] players = Bukkit.getOnlinePlayers();
for (Player player : players) {
if (!plugin.getCurrVotes().contains(player.getName())) {
player.sendMessage(translatedList.toArray(new String[0]));
} e... |
fd75191e-fda4-408a-81b0-089112bacdf9 | 3 | public void setInput (ArrayList<String> val) {
if(val == null){
this.input = new ArrayList<String>();
return;
}
if(val.size() == 0)
this.input = val;
else
for(String s:val)
addToInput(s);
} |
f8a9fc81-d23b-45d5-ac89-f4c170c18bee | 5 | public Class<?> initialize(Class<?> sourceValueType) {
if (_methods != null) {
if (_methods.length == 0)
return sourceValueType;
return _methods[_methods.length - 1].getReturnType();
}
_methods = new PropertyMethod[_properties.length];
for (int i = 0; i < _properties.length; i++) ... |
74c5c696-6d96-4e03-ab12-0f3e3d00f43b | 7 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDropItem(PlayerDropItemEvent event)
{
// CAUTION:This event fires, BEFORE the dropped item is removed from the inventory!
// therefore, delay all checks for 1 tick because "itemInHand()" is needed for checks
... |
ba625f97-6916-4eaf-ae52-56b0cbd355bf | 1 | public IdentificadorVariavelTipoPredefinido(String nome, int deslocamento,
Tipo tipo) throws SemanticError {
super(nome, deslocamento, tipo);
if(!Tipo.isPreDefinido(tipo))
throw new SemanticError("Este tipo de variável exige um tipo pré-definido");
} |
da4c8415-ff98-4a40-b1cd-57ba59ed0f6f | 6 | 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... |
730fdd96-35f1-48d2-9efa-134b544c39c7 | 3 | final void revalidate(boolean pack, boolean toFront) {
if (this.master.isInterrupted()) {
return;
}
if (pack) {
this.mainFrame.pack();
}
this.mainFrame.revalidate();
this.mainFrame.repaint();
if (toFront) {
this.mainFrame.toFront();
}
} |
75caf3a6-30de-4ade-9c22-a7ef44f374a3 | 3 | public static Object createNMSTextComponent(String text) {
if (text == null || text.isEmpty()) {
return null;
}
Class c = getClassByName(getNMSPackageName() + ".ChatComponentText");
try {
Constructor constructor = c.getDeclaredConstructor(String.class);
return constructor.newInstance(text);
} catch ... |
50f5492c-a395-4371-88d8-167a27eff786 | 4 | private String cipher_sub(char[][] square1,char[][] square2, HashMap<Character,Pair<Integer>> h1,String p)
{
String p_u=p.toUpperCase();
ArrayList<Integer> row=new ArrayList<Integer>();
ArrayList<Integer> col=new ArrayList<Integer>();
for(int i=0;i<p_u.length();i++)
{
char cur_c=p_u.charAt(i);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.